camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Issue with JAXRS/JAXWS CXF service marshal to/from JSON
Date Wed, 15 Jun 2011 12:44:53 GMT
Hi Mick

Haven't had time to look into your Q. Been struck a bit with headache
this week, so I am not running at full speed. I guess other ppl in the
community is busy as well.

Try to make a simple route that demonstrate one issue at a time. Then
its easier to rationale spending 5 min to look into / help others. If
its too long and looks to complex, then ppl may not bother helping
you.


On Wed, Jun 15, 2011 at 1:17 PM, Mick Knutson <mknutson@baselogic.com> wrote:
> Was my question too complex? Too simple?
> I really feel at a loss as to the solution as I feel I have tried several
> different options with no real luck. I would truly appreciate any help.
> Thanks very much in advance.
>
>
> ---
> Thank You…
>
> Mick Knutson, President
>
> BASE Logic, Inc.
> Enterprise Architecture, Design, Mentoring & Agile Consulting
> p. (855) BASE-LOGIC: (227-3564-42)
> p. (478) BASE-LOGIC (227-3564-42)
> f. (855) BASE-LOGIC: (227-3564-42)
>
> Website: http://www.baselogic.com
> Blog: http://www.baselogic.com/blog/
> Linked IN: http://linkedin.com/in/mickknutson
> Twitter: http://twitter.com/mickknutson
> ---
>
>
>
> On Mon, Jun 13, 2011 at 10:53 AM, Mick Knutson <mknutson@baselogic.com>wrote:
>
>> I started with the camel-example-cxf from SVN and have the JAXWSClient and
>> JAXRSClient working to send a custom Object into Camel:
>>
>>         from(REST_ENDPOINT_URI).routeId("REST_ENDPOINT_URI")
>>                 .process(new MappingProcessor(new
>> EventProcessorImpl(true)))
>>                 .wireTap(INPUT_CALL_SESSION).end()
>>         ;
>>
>> What I want to do is take the CallSession object I am trying to pass in,
>> then:
>>
>> 1. Marshal to JSON like:
>>         from(INPUT_CALL_SESSION).routeId("INPUT_CALL_SESSION")
>>                 .marshal().json(JsonLibrary.Jackson)
>>                 .to(INPUT_MARSHALED)
>>         ;
>>
>>
>>
>> 2. UnMarshal from JSON back to a CallSession and use via a bean, and write
>> the JSON to a file like:
>>
>>         from(INPUT_PROCESSED).routeId("INPUT_PROCESSED")
>>                 //.unmarshal().json().bean(new ValidationProcessor())
>>                 .unmarshal(jacksonDataFormat).bean(new
>> ValidationProcessor())
>>
>>                 .setHeader(Exchange.FILE_NAME,
>> constant(PROCESSED_FILE_NAME))
>>                 .multicast()
>>                 .to(MOCK_RESULT, PROCESSED_FILE_DIR)
>>         ;
>>
>> So when I us *.marshal().json() *and write to a file, I get something
>> like:
>>
>>
>> {"com.comcast.ivr.core.domain.CallSession":{"callProgression":{"@class":"linked-list"},"browserType":"AVAYA","dasSessionId":"3dceda7c-e04c-4fd0-9052-
>>
>> Then try to unmarshal with *.unmarshal().json().bean(new
>> ValidationProcessor())*, I get roll backs and no files written.
>>
>>
>> Next when I us *.marshal().json(JsonLibrary.Jackson)* and write to a file,
>> I get something like:
>>
>>
>> {"duration":0,"dasSessionId":"90d2a3e1-0535-4896-a74e-a077d27c3245","asyncResultsContainer":{"queryOutagesFuture":null},"lastCallProgressionState":null,"techSupportFunctionalArea":null,
>>
>> Then try to unmarshal with *.unmarshal().json(JsonLibrary.Jackson).bean(new
>> ValidationProcessor())*, I get roll backs and no files written.
>>
>>
>>
>> Then when I us *.marshal().json(jacksonDataFormat)* using this mapper:
>>
>>         JacksonDataFormat jacksonDataFormat = new JacksonDataFormat();
>>         jacksonDataFormat.getObjectMapper().configure(
>>             SerializationConfig.Feature.INDENT_OUTPUT, true);
>>         jacksonDataFormat.getObjectMapper()
>>             .enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
>>         jacksonDataFormat.getObjectMapper().viewWriter(CallSession.class);
>>
>> and write to a file, I get something like:
>>
>> [ "com.comcast.ivr.core.domain.CallSession", {
>>   "duration" : 0,
>>   "dasSessionId" : "2c1fb05a-f6d7-434f-b62d-73ce4244fc9e",
>>
>> Then try to unmarshal with *.unmarshal().json(jacksonDataFormat).bean(new
>> ValidationProcessor())*, I get roll backs and no files written.
>>
>>
>>
>>
>>
>> Can someone help me get this simple CXF to JSON to CallSession Object
>> example working and shed some light on what I seem to be missing here?
>>
>> Thanks in advance
>>
>>
>> ---
>> Thank You…
>>
>> Mick Knutson, President
>>
>> BASE Logic, Inc.
>> Enterprise Architecture, Design, Mentoring & Agile Consulting
>> p. (855) BASE-LOGIC: (227-3564-42)
>> p. (478) BASE-LOGIC (227-3564-42)
>> f. (855) BASE-LOGIC: (227-3564-42)
>>
>> Website: http://www.baselogic.com
>> Blog: http://www.baselogic.com/blog/
>> Linked IN: http://linkedin.com/in/mickknutson
>> Twitter: http://twitter.com/mickknutson
>> ---
>>
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message