You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by docs123 <ri...@gmail.com> on 2008/07/23 13:11:19 UTC

How to use camel for calling 2 webservices that one is dependent on the other

Hi,
I'm new to camel and I need help to see if I use camel for implementing the
following flow:
User calls camel with input containing A and B elements.
Camel will take element A and call webservice A (sending it element A as an
input):

1. In case webservice A returns true - camel will call webservice B with
element B (from the original input message) as an input, and the output back
to the user will be the output from webservice B.

2. In case A returns false - the user will recieve some error message.

Can I implement this flow with camel built-in processors or do I need to
write my own processors?

Thanks 

-- 
View this message in context: http://www.nabble.com/How-to-use-camel-for-calling-2-webservices-that-one-is-dependent-on-the-other-tp18608192s22882p18608192.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to use camel for calling 2 webservices that one is dependent on the other

Posted by Willem Jiang <wi...@gmail.com>.
You can do want you want in the PrepearParmeterForWebServiceB(), 
basically the inMessage's body that is passed to this processor is 
changed to be the response of webservice A. If you want to get the 
original input , you'd better store the original input into the message 
header before sending the request to webservice A .

Willem.

docs123 wrote:
> Thanks.
> Just want to be sure - The second processor (
> PrepearParameterForWebServiceB() ) will "know" to process the original input
> and will not refer to the output recieved from webservice A as the input it
> needs to process?
>
>
> willem.jiang wrote:
>   
>> Hi ,
>>
>> I think you could use choice [1] to implement the flow, since there are 
>> some requirements of the webservice request[2], you may need a processor 
>> to take care of the parameters.
>> Here is an example of DSL
>>
>> from("YourStartPoint")
>>       .process(new
>> PrepearParameterForWebServiceA()).to("cxf://WebServiceA")
>>              .choice(when(body().isEqualTo(Boolean.TRUE))).process(new 
>> PrepearParameterForWebServiceB()).to("cxf://WebServiceB")
>>
>>        .otherwise().process(new SetFaultBackProcessor());
>>
>>
>> [1]http://activemq.apache.org/camel/routes.html#Routes-Choices
>> [2]http://activemq.apache.org/camel/cxf.html#CXF-HowtopreparethemessageforthecamelcxfendpointinPOJOdataformat
>>
>> Willem
>>
>> docs123 wrote:
>>     
>>> Hi,
>>> I'm new to camel and I need help to see if I use camel for implementing
>>> the
>>> following flow:
>>> User calls camel with input containing A and B elements.
>>> Camel will take element A and call webservice A (sending it element A as
>>> an
>>> input):
>>>
>>> 1. In case webservice A returns true - camel will call webservice B with
>>> element B (from the original input message) as an input, and the output
>>> back
>>> to the user will be the output from webservice B.
>>>
>>> 2. In case A returns false - the user will recieve some error message.
>>>
>>> Can I implement this flow with camel built-in processors or do I need to
>>> write my own processors?
>>>
>>> Thanks 
>>>
>>>   
>>>       
>>
>>     
>
>   


Re: How to use camel for calling 2 webservices that one is dependent on the other

Posted by docs123 <ri...@gmail.com>.
Thanks.
Just want to be sure - The second processor (
PrepearParameterForWebServiceB() ) will "know" to process the original input
and will not refer to the output recieved from webservice A as the input it
needs to process?


willem.jiang wrote:
> 
> Hi ,
> 
> I think you could use choice [1] to implement the flow, since there are 
> some requirements of the webservice request[2], you may need a processor 
> to take care of the parameters.
> Here is an example of DSL
> 
> from("YourStartPoint")
>       .process(new
> PrepearParameterForWebServiceA()).to("cxf://WebServiceA")
>              .choice(when(body().isEqualTo(Boolean.TRUE))).process(new 
> PrepearParameterForWebServiceB()).to("cxf://WebServiceB")
> 
>        .otherwise().process(new SetFaultBackProcessor());
> 
> 
> [1]http://activemq.apache.org/camel/routes.html#Routes-Choices
> [2]http://activemq.apache.org/camel/cxf.html#CXF-HowtopreparethemessageforthecamelcxfendpointinPOJOdataformat
> 
> Willem
> 
> docs123 wrote:
>> Hi,
>> I'm new to camel and I need help to see if I use camel for implementing
>> the
>> following flow:
>> User calls camel with input containing A and B elements.
>> Camel will take element A and call webservice A (sending it element A as
>> an
>> input):
>>
>> 1. In case webservice A returns true - camel will call webservice B with
>> element B (from the original input message) as an input, and the output
>> back
>> to the user will be the output from webservice B.
>>
>> 2. In case A returns false - the user will recieve some error message.
>>
>> Can I implement this flow with camel built-in processors or do I need to
>> write my own processors?
>>
>> Thanks 
>>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-use-camel-for-calling-2-webservices-that-one-is-dependent-on-the-other-tp18608192s22882p18626263.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to use camel for calling 2 webservices that one is dependent on the other

Posted by Willem Jiang <wi...@gmail.com>.
Hi ,

I think you could use choice [1] to implement the flow, since there are 
some requirements of the webservice request[2], you may need a processor 
to take care of the parameters.
Here is an example of DSL

from("YourStartPoint")
      .process(new PrepearParameterForWebServiceA()).to("cxf://WebServiceA")
             .choice(when(body().isEqualTo(Boolean.TRUE))).process(new 
PrepearParameterForWebServiceB()).to("cxf://WebServiceB")

       .otherwise().process(new SetFaultBackProcessor());


[1]http://activemq.apache.org/camel/routes.html#Routes-Choices
[2]http://activemq.apache.org/camel/cxf.html#CXF-HowtopreparethemessageforthecamelcxfendpointinPOJOdataformat

Willem

docs123 wrote:
> Hi,
> I'm new to camel and I need help to see if I use camel for implementing the
> following flow:
> User calls camel with input containing A and B elements.
> Camel will take element A and call webservice A (sending it element A as an
> input):
>
> 1. In case webservice A returns true - camel will call webservice B with
> element B (from the original input message) as an input, and the output back
> to the user will be the output from webservice B.
>
> 2. In case A returns false - the user will recieve some error message.
>
> Can I implement this flow with camel built-in processors or do I need to
> write my own processors?
>
> Thanks 
>
>