Use data from response to call next webservice
Hi,
I'm trying to create the following setup with WSO2 ESB:
I want to combine the responses from several web services into one "aggregated" service response and expose this as a new (proxy) service into the ESB. To be able to do this I need to create a the following:
1. Get the request into the ESB (using a proxy service for that)
2. Transform the request to a request for an internal service (service A) and call that service)
3. Get some values from the response of service A and call service B with these values as the input (I guess this can be done with an xslt?)
4. Combine/transform data from the response of service A and service B to create the response to the original request that came into the ESB.
Can this be done in ESB? And if so, what's the best way to do this?
Kind regard and thanks in advance,
Danny
- Login or register to post comments
- Printer friendly version
- 145 reads











Hi Danny, I think this is
Hi Danny,
I think this is similar to what you are trying to do. Well it is not exactly the same, but you will be able to get some understanding.
http://wso2.org/forum/thread/3966
Also you may have a look at this article in which it creates a Composite service, and you may need to transform the response from Service A before calling the Service B. You can use the XSLT mediator to achieve this transformation.
http://wso2.org/library/3422#composite
Also this Case Study describes a somewhat similar scenario..
http://wso2.org/library/3325
Thanks,
Ruwan Linton
Danny, I'm working with a
Danny,
I'm working with a similar scenario, and Ruwan guided me in the direction of using the callout mediator. The callout has configuration for the target (webservice a), the source data (could be the original payload), and a place to put the target response. You can manipulate directly via script, or possibly apply an XSLT.
Before using the callout mediator, I was picking up the response of webservice A in the outSequence, performing adjustments and sending that on to service B which response can be handled again in the same out sequence for a proxy.
Either way is doable, but I think the use of the callout mediator is more elegant.
-Lucas
Hi Danny/Lucas, Yes, callout
Hi Danny/Lucas,
Yes, callout mediator is the more elegant way of doing this, but it has some limitations. For example you cannot do much configurations of the output message of the callout mediator, i.e. to add security to call the services and so on.
Being said that I must also tell that, if there is *no* need of a blocking call where you need the response from the service to be aggregated with some *request* parameters to call the second service, then it is good to skip the callout mediator for performance improvements.
Thanks,
Ruwan Linton