Reputation: 424
Can anybody explain with generic example what callout mediator does? and how to configure source and target ? How callout mediator is different from send mediator?
Upvotes: 1
Views: 1130
Reputation: 4729
You can find a good explanation in the WSO2 Documentation of the Callout Mediator.
Here is a simple example we often use to send the whole content and store the response inside a property:
<callout serviceURL="http://wsf.cdyne.com/WeatherWS/Weather.asmx" action="http://ws.cdyne.com/WeatherWS/GetWeatherInformation">
<source type="envelope"/>
<target key="response"/>
</callout>
<!-- print the response property -->
<log level="custom">
<property name="response" expression="get-property('response')"/>
</log>
You can find another example here.
Upvotes: 1
Reputation: 579
'source' specifies the payload for the request message using an XPath expression (We can select desired xml nodes to send as a request) or a registry key (where we can store the request message in the registry). The 'target' specifies a node at which the resulting payload (response) will be attached in the current message context.
The difference between callout mediator and send mediator is that callout mediator will return the response to the same sequence by doing a blocking call. So the callout mediator keeps the thread until transaction done.
In send mediator response is returned to the OutSequence in where you can send it back to the client.So the thread will release immediately sending the message out.
This is a good blog where you can find the usage.
Upvotes: 3