git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple example of passing an object in from rest to another microservice


Hi

For binding to POJO classes you need to add camel-jackson to the
classpath, and have either JAXB or Jackson annotations on the class as
well.

On Wed, Jun 13, 2018 at 7:34 PM, Roman Vottner <rovo@xxxxxx> wrote:
> Can you try to define
>
>    .bindingMode(RestBindingMode.json)
>
> to your restConfiguration or post() definition? According to the docs (http://camel.apache.org/rest-dsl.html) it should enable conversion to/from JSON to POJO which according your your posted logs seem to fail.
>
> HTH,
> roman
>
>
>> Am 13.06.2018 um 15:10 schrieb Steve Hiller <shetc@xxxxxxxxxxxxx>:
>>
>> No responses -- Am I doing this completely wrong?
>>
>>    On Friday, June 8, 2018 6:07 PM, Steve Hiller <shetc@xxxxxxxxxxxxx> wrote:
>>
>>
>> Hi All,
>>
>> I recently watched Claus' talk called "Developing cloud-ready Camel microservices". I am trying to do the following:
>>
>> rest("/candidate")
>>   .post("applyx")
>>   .consumes(MediaType.APPLICATION_JSON_VALUE)
>>   .type(Candidate.class)
>>   .to("direct:passwordlessApply")
>> ;
>>
>>
>> from("direct:passwordlessApply")
>>   .setExchangePattern(ExchangePattern.InOnly)
>>   .to("http4:{{service:candidate-service}}/api/candidate/applyx")
>> ;
>>
>>
>> where {{service:candidate-service}} also consumes the Candidate class.
>>
>> However, I am seeing the following exception:
>>
>> org.apache.camel.InvalidPayloadException: No body available of type: java.io.InputStream but has value: com.rusa.adapter.mobile.candidate.domain.Candidate@58af86ed...
>> Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: com.rusa.adapter.mobile.candidate.domain.Candidate to the required type: java.io.InputStream with value com.rusa.adapter.mobile.candidate.domain.Candidate@58af86ed...
>> Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: com.rusa.adapter.mobile.candidate.domain.Candidate to the required type: java.io.InputStream with value com.rusa.adapter.mobile.candidate.domain.Candidate@58af86ed
>>
>> Any help is most appreciated.
>>
>> Thanks,
>>
>> Steve
>>
>>
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2



( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-camel-users/msg03397.html on line 135
Call Stack
#TimeMemoryFunctionLocation
10.0008368696{main}( ).../msg03397.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-camel-users/msg03397.html on line 135
Call Stack
#TimeMemoryFunctionLocation
10.0008368696{main}( ).../msg03397.html:0