This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagehtml/xml
<jsonObject xmlns="http://services.samples">
    <getQuote>
        <request>
            <symbol>WSO2</symbol>
        </request>
    </getQuote>
</jsonObject>

Finally the Enrich Mediator extracts the getQuote element from the above payload and attaches it as the first child of the current payload so that the final SOAP request that is sent to the service has the following format.

Code Block
languagehtml/xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <getQuote xmlns="http://services.samples">
            <request>
                <symbol>WSO2</symbol>
            </request>
        </getQuote>
    </soapenv:Body>
</soapenv:Envelope>

We need to perform this sequence of transformations to the incoming JSON request to convert it and build the XML SOAP request expected by the service.  Note that the XSLT transformation in the outSequence (line 22) can be omitted because the JSON message formatter already knows how to format any XML payload to JSON.

The final response will look like the following:

Code Block
languagejavascript
{
   "getQuoteResponse":{
      "return":{
         "change":3.853593376681722,
         "earnings":12.802850763714854,
         "high":67.92488310190126,
         "last":66.14619264746406,
         "lastTradeTimestamp":"Mon Aug 23 16:48:40 IST 2010",
         "low":-66.04000424423522,
         "marketCap":-9334516.42324327,
         "name":"WSO2 Company",
         "open":-64.61950137150009,
         "peRatio":-19.78600441437058,
         "percentageChange":5.411779328273005,
         "prevClose":71.2075112994578,
         "symbol":"WSO2",
         "volume":16842
      }
   }
}

...