camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brad Johnson <brad.john...@mediadriver.com>
Subject Re: Help with JSON to POJO using XML Routes
Date Wed, 28 Sep 2016 17:02:36 GMT
I didn't see in your initial code anything that set up the dataFormat.
That along with the unmarsal/marshal are what you need to get it to work
correctly, not just using a bean.

<dataFormats>
        <json id="jack" library="Jackson" unmarshalTypeName="com.example.
RetailStoreReturnPOJO""/>
</dataFormats>

Then in your route, right after your call* to* http4 you put:


 <unmarshal ref="jack"/>



On Wed, Sep 28, 2016 at 11:56 AM, Brad Johnson <brad.johnson@mediadriver.com
> wrote:

> Jackson works fine and I've used it many times.  So does JAXB for JSON.
> Just remember to put the @XmlRootElement annotation on your bean in that
> case (yeah, even it if is only being used for JSON). I really wouldn't fool
> with the gapping of strings to a hashmap. You'll just create headaches. You
> can also use XStream with jettison.  XStream is one of my favorite
> libraries though I don't usually use it to marshal/unmarshal JSON.
>
> Right after your call to http4 log the return data and post it.  One item
> I've seen in the past in the context of web service calls is that it will
> put the individual elements it gets back in an array and you have to fish
> the zeroeth element out of the array to get the actual item you're looking
> for.
>
> But if you just print out/log what you get right after the call TO http
> that should help.
>
> Brad
>
>
>
>
>
> On Wed, Sep 28, 2016 at 8:36 AM, jeffz <jzeha@hotmail.com> wrote:
>
>> That's actually how it originally was, but I changed it while working on
>> my
>> older 'stream closed' issue.  I can switch that back.  I'm actually pretty
>> close now, just running into some issues reading certain fields within the
>> map object.
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.
>> com/Help-with-JSON-to-POJO-using-XML-Routes-tp5788130p5788158.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message