camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Müller <christian.muel...@gmail.com>
Subject Re: Content enrich via WS
Date Thu, 17 May 2012 09:18:42 GMT
My recommendation:

from("direct:start")
  .enrich("direct:sub", MyAggregationStrategy()) // see [1] and [2]
  .to("direct:end");

from("direct:sub")
  .convertBodyTo(WebServiceRequest.class) // see [3]
  .to("cxf:bean:SomeWebService");

The MyAggregationStrategy.aggregate(Exchange oldExchange, Exchange
newExchange) is called with the "oldExchange" which contains your original
message (oldExchange.getIn()) and with the newExchange which contains the
response of the web service you called (newExchange.getIn()). Than you can
"merge" or whatever you want with both exchanges.

[1] http://camel.apache.org/content-enricher.html
[2]
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/aggregate/AggregationStrategy.html
[3] http://camel.apache.org/type-converter.html

Best,
Christian

On Thu, May 17, 2012 at 3:52 AM, Willem Jiang <willem.jiang@gmail.com>wrote:

> You can put your XML message into exchange as property, it will be copy
> across the endpoints.
> And you can extract the ID, and send it to a camel-cxf[1] endpoint without
> create the entire SOAP message yourself.
>
> Then you need to put all these information back in your custom bean[2].
>
> [1]http://camel.apache.org/**cxf.html <http://camel.apache.org/cxf.html>
> [2]http://camel.apache.org/**bean.html <http://camel.apache.org/bean.html>
>
>
> On Wed May 16 22:32:38 2012, pvunckx wrote:
>
>> Case:
>> I receive an XML message who contains a lot of data, one of the fields is
>> an
>> ID of a person.
>> Via this ID (and only this ID) I need to construct a SOAP message to make
>> a
>> WS-call who will return extra information that I need to merge with the
>> initial (!!) message.
>>
>>
>> I support I have to use the ‘enrich’ method
>> 1/ But for the uri what do I need to use ? A CXF uri ?
>> 2/ I can construct a message for the CXF WS but doesn’t I lose that way
>> the
>> original message ? Which I still need to do the merge (Of how do I get
>> this
>> message back?)
>>
>> Pseudo-code:
>> > From (“direct:start’)
>>   .transform() //convert xml msg to xml msg for first ws call
>>   .enrich (uri, strategy)  //uri ? , strategy  can I access the initial
>> msg?
>> .to(cxf-ws);    //call second ws with enrich initial msg
>>
>> Thanks for tips and tricks!!
>> Pieter
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.**
>> com/Content-enrich-via-WS-**tp5710911.html<http://camel.465427.n5.nabble.com/Content-enrich-via-WS-tp5710911.html>
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Willem
> ------------------------------**----
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
>        http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
>
>

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