You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by wanggang1 <wa...@gmail.com> on 2012/02/04 19:00:40 UTC
Camel Request-Reply pattern
Hi,
I'm new with Camel. I have tried to search the web for an answer but could
not come up with one. Here is my question. I need to route a http request
to a Web Service. The http request is in existing application so I could
not change its nature(i.e. async). My thinking is that I need to use
Request-Reply pattern and transform XML to SOAP then SOAP to XML on its way
back.
First, is these the correct approach?
Second,the request-reply sample shown in Camel document has the response
from Replier going directly to Requester. Can I add a transformer in
between?
Please help, and it'll be great if you could add a routing sample code.
Thanks
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Request-Reply-pattern-tp5456573p5456573.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Request-Reply pattern
Posted by wanggang1 <wa...@gmail.com>.
Thanks to both Claus and Chris for your timely reply!
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Request-Reply-pattern-tp5456573p5457894.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Request-Reply pattern
Posted by wanggang1 <wa...@gmail.com>.
Hi Claus,
Could you explain a little further? I have something like following, but
after I process the return the response is not returned to the producer even
with setting ExchangePattern to InOut. Thanks!
from("jetty:http://localhost:8888/stockquote?matchOnUriPrefix=true")
.streamCaching()
.process(new Processor() {
@Override
public void process(final Exchange exchange) throws Exception {
........
}
})
.to("http://www.webservicex.net/stockquote.asmx?bridgeEndpoint=true&throwExcpetionOnFailure=false")
.process(new Processor() {
@Override
public void process(final Exchange exchange) throws Exception {
.........
exchange.setPattern(ExchangePattern.InOut);
}
});
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Request-Reply-pattern-tp5456573p5503686.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Request-Reply pattern
Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Feb 4, 2012 at 7:00 PM, wanggang1 <wa...@gmail.com> wrote:
> Hi,
>
> I'm new with Camel. I have tried to search the web for an answer but could
> not come up with one. Here is my question. I need to route a http request
> to a Web Service. The http request is in existing application so I could
> not change its nature(i.e. async). My thinking is that I need to use
> Request-Reply pattern and transform XML to SOAP then SOAP to XML on its way
> back.
>
> First, is these the correct approach?
> Second,the request-reply sample shown in Camel document has the response
> from Replier going directly to Requester. Can I add a transformer in
> between?
>
Yes that is possible.
from HTTP
transform
to WS
transform (*)
When the route ends at (*) then that's the reply going back to the
requester (http client).
There are many ways in Camel you can transform a message.
You can send messages to an endpoint, eg a XSTL endpoint, you can use
a Java bean, etc.
Its the Message Translator EIP
http://camel.apache.org/message-translator.html
> Please help, and it'll be great if you could add a routing sample code.
>
> Thanks
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Request-Reply-pattern-tp5456573p5456573.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
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/
Re: Camel Request-Reply pattern
Posted by Christian Schneider <ch...@die-schneider.net>.
The descriptions on this page may help you. They describe the request
reply pattern when using several processors and also
how the reply goes back to the from.
http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html
To make it short you can use a transform easily. The camel-cxf component
can do the xml to soap and vice a versa for you.
Use the payload mode to achieve that.
Christian
Am 04.02.2012 19:00, schrieb wanggang1:
> Hi,
>
> I'm new with Camel. I have tried to search the web for an answer but could
> not come up with one. Here is my question. I need to route a http request
> to a Web Service. The http request is in existing application so I could
> not change its nature(i.e. async). My thinking is that I need to use
> Request-Reply pattern and transform XML to SOAP then SOAP to XML on its way
> back.
>
> First, is these the correct approach?
> Second,the request-reply sample shown in Camel document has the response
> from Replier going directly to Requester. Can I add a transformer in
> between?
>
> Please help, and it'll be great if you could add a routing sample code.
>
> Thanks
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Request-Reply-pattern-tp5456573p5456573.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
Talend Application Integration Division http://www.talend.com