com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.
Sample 352: Accessing Synapse message context API using a scripting language
Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation:
<PRODUCT_HOME>/
repository/samples/
directory that includes all Integration profile samples is changed to<EI_HOME>/
samples/service-bus/
.<PRODUCT_HOME>/
repository/samples/resources/
directory that includes all artifacts related to the Integration profile samples is changed to<EI_HOME>/
samples/service-bus/resources/
.
Objective: Accessing the Synapse APIs from scripting languages
Prerequisites:
- Start the Synapse configuration numbered 352: i.e.
wso2esb-samples.sh -sn 352
- Start the Axis2 server and deploy the SimpleStockQuoteService if not already done.
Â
<definitions xmlns="http://ws.apache.org/ns/synapse"> <in> <!-- change the MessageContext into a response and set a response payload --> <script language="js"><![CDATA[ mc.setTo(mc.getReplyTo()); mc.setProperty("RESPONSE", "true"); mc.setPayloadXML( <ns:getQuoteResponse xmlns:ns="http://services.samples/xsd"> <ns:return> <ns:last>99.9</ns:last> </ns:return> </ns:getQuoteResponse>); ]]></script> </in> <send/> </definitions>
This example shows how an inline JavaScript mediator script could access the Synapse message context API to set its 'To' EPR and to set a custom property to mark it as a response. Execute the stock quote client, and you will receive the response "99.9" as the last sale price as per the above script.
Â
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/
Â
Â
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.