This documentation is for WSO2 Enterprise Service Bus version 4.7.0 . View documentation for the latest release.
Skip to end of metadata
Go to start of metadata

Objective: Introduction to inline script mediation


  • Start the Synapse configuration numbered 351: i.e. -sn 351
  • Start the Axis2 server and deploy the SimpleStockQuoteService if not already done.
<definitions xmlns="">
        <!-- transform the custom quote request into a standard quote requst expected by the service -->
        <script language="js"><![CDATA[
               var symbol = mc.getPayloadXML()..*::Code.toString();
                  <m:getQuote xmlns:m="http://services.samples/xsd">
                <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
        <!-- transform the standard response back into the custom format the client expects -->
        <script language="js"><![CDATA[
               var symbol = mc.getPayloadXML()..*::symbol.toString();
               var price = mc.getPayloadXML()..*::last.toString();
                  <m:CheckPriceResponse xmlns:m="http://services.samples/xsd">

The functionality of this sample is similar to that of sample 350 and sample 8. It demonstrates how to use inline scripts in the mediation within the ESB. Use the stock quote client to send a custom quote request as described in sample 350.

  • No labels