Author: indika Date: Wed Jul 1 01:46:37 2009 New Revision: 40491 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=40491
Log: script mediator doc update Modified: trunk/esb/java/docs/xdoc/mediators/script.xml Modified: trunk/esb/java/docs/xdoc/mediators/script.xml URL: http://wso2.org/svn/browse/wso2/trunk/esb/java/docs/xdoc/mediators/script.xml?rev=40491&r1=40490&r2=40491&view=diff ============================================================================== --- trunk/esb/java/docs/xdoc/mediators/script.xml (original) +++ trunk/esb/java/docs/xdoc/mediators/script.xml Wed Jul 1 01:46:37 2009 @@ -122,5 +122,31 @@ <p>Scripts sources to be included</p> <h3>Example </h3> +<ol> + <li><pre><script language="js">mc.getPayloadXML()..symbol != "IBM";<script/></pre> + <p>The above configuration is an example of an inline mediator using + JavaScript/E4X which returns false if the SOAP message body contains an + element named 'symbol' which has a value of 'IBM' would be:</p> + </li> + <li><pre><script language="js" + key="repository/conf/sample/resources/script/test.js" + function="testFunction"/> + </pre> + <p>In the above example, script is loaded from the registry by using the + key <strong>repository/conf/sample/resources/script/test.js.</strong> The + script is written in java script. The function to be invoked is + <strong>testFunction</strong> . As example for test.js shown in the bellow. + </p> + <pre>function testFunction(<strong>mc</strong>) { + var symbol = <strong>mc.getPayloadXML()</strong>..*::Code.toString(); + <strong>mc.setPayloadXML</strong>( + <m:getQuote xmlns:m="http://services.samples/xsd"> + <m:request> + <m:symbol>{symbol}</m:symbol> + </m:request> + </m:getQuote>); +}</pre> + </li> +</ol> </body> </html> _______________________________________________ Esb-java-dev mailing list [email protected] https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev
