Search code examples
mediatorcalloutwso2-esb

Callout and send mediator in wso2 esb


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?


Solution

  • You can find a good explanation in the WSO2 Documentation of the Callout Mediator.

    • Source: Defines the payload for the request. There are three options (XPath, Property, Envelope) to define where the payload comes from. Most of the time we use Envelope to send the complete content.
    • Target: Defines where the response should be stored. There are options (XPath and Property), to either set the response in the current message or inside a property.

    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.