Hi, I revised the script mediator samples with the current configuration language. i modified the Synapse_Samples.html and attached the patch with this. Please review it and apply the patch.
Thanks, Kasun
Index: Synapse_Samples.html =================================================================== --- Synapse_Samples.html (revision 532180) +++ Synapse_Samples.html (working copy) @@ -1820,41 +1820,41 @@ directory which are required. </p> <h2><a name="Sample500">Sample 500:</a></h2> -<pre><synapse xmlns="http://ws.apache.org/ns/synapse"> +<pre><definitions xmlns="http://ws.apache.org/ns/synapse"> <!-- Introduction to the script mediator --> - <definitions> + <!-- define a static property for the JavaScript source code file --> - <set-property name="stockquoteScript" src="file:repository/conf/sample/resources/script/stockquoteTransform.js"/> + <localEntry key="stockquoteScript" src="file:repository/conf/sample/resources/script/stockquoteTransform.js"/> <!-- define a reuseable endpoint definition and use it within config --> - <endpoint name="stockquote" address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/> + <endpoint name="stockquote"> + <address uri="http://localhost:9000/axis2/services/SimpleStockQuoteService"/> + </endpoint> + - </definitions> - - <rules> <in> <!-- transform the custom quote request into a standard quote request expected by the service --> - <script key="stockquoteScript" function="transformRequest"/> + <script language="js" key="stockquoteScript" function="transformRequest"/> <!-- send message to real endpoint referenced by name "stockquote" and stop --> <send> - <endpoint ref="stockquote"/> + <endpoint key="stockquote"/> </send> </in> <out> <!-- transform the standard response back into the custom format the client expects --> - <script key="stockquoteScript" function="transformResponse"/> + <script language="js" key="stockquoteScript" function="transformResponse"/> <!-- now send the custom response back to the client and stop --> <send/> </out> - </rules> + -</synapse> </pre> +</definitions> </pre> <p><strong>Objective: Introduction to script mediators</strong></p> @@ -1900,21 +1900,18 @@ message processing.</p> <h2><a name="Sample501">Sample 501:</a></h2> -<pre><synapse xmlns="http://ws.apache.org/ns/synapse"> +<pre><definitions xmlns="http://ws.apache.org/ns/synapse"> <!-- Introduction to the script mediator using in-line scripts --> - <definitions> + <!-- define a reuseable endpoint definition and use it within config --> + <endpoint name="stockquote"> + <address uri="http://localhost:9000/axis2/services/SimpleStockQuoteService"/> + </endpoint> - <!-- define a reuseable endpoint definition and use it within config --> - <endpoint name="stockquote" address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/> - - </definitions> - - <rules> - <in> + <in> <!-- transform the custom quote request into a standard quote requst expected by the service --> - <script.js><![CDATA[ + <script language="js"><![CDATA[ var symbol = mc.getPayloadXML()..*::Code.toString(); mc.setPayloadXML( <m:getQuote xmlns:m="http://services.samples/xsd"> @@ -1922,17 +1919,17 @@ <m:symbol>{symbol}</m:symbol> </m:request> </m:getQuote>); - ]]></script.js> + ]]></script> <!-- send message to real endpoint referenced by name "stockquote" and stop --> <send> - <endpoint ref="stockquote"/> + <endpoint key="stockquote"/> </send> - </in> + </in> - <out> + <out> <!-- transform the standard response back into the custom format the client expects --> - <script.js><![CDATA[ + <script language="js"><![CDATA[ var symbol = mc.getPayloadXML()..*::symbol.toString(); var price = mc.getPayloadXML()..*::last.toString(); mc.setPayloadXML( @@ -1940,14 +1937,14 @@ <m:Code>{symbol}</m:Code> <m:Price>{price}</m:Price> </m:CheckPriceResponse>); - ]]></script.js> + ]]></script> <!-- now send the custom response back to the client and stop --> <send/> - </out> - </rules> + </out> + -</synapse> </pre> +</definitions> </pre> <p><strong>Objective: Introduction to in-line script mediators</strong></p> @@ -1985,41 +1982,41 @@ message processing.</p> <h2><a name="Sample503">Sample 503:</a></h2> -<pre><synapse xmlns="http://ws.apache.org/ns/synapse"> +<pre><definitions xmlns="http://ws.apache.org/ns/synapse"> <!-- Introduction to the script mediator with Ruby scripts--> - <definitions> + <!-- define a static property for the JRuby source code file --> + <localEntry key="stockquoteScript"> + <address src="file:repository/conf/sample/resources/script/stockquoteTransform.rb"/> + </localEntry> - <!-- define a static property for the JRuby source code file --> - <set-property name="stockquoteScript" src="file:repository/conf/sample/resources/script/stockquoteTransform.rb"/> + <!-- define a reuseable endpoint definition and use it within config --> + <endpoint name="stockquote"> + <address uri="http://localhost:9000/axis2/services/SimpleStockQuoteService"/> + </endpoint> + - <!-- define a reuseable endpoint definition and use it within config --> - <endpoint name="stockquote" address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/> - - </definitions> - - <rules> - <in> + <in> <!-- transform the custom quote request into a standard quote request expected by the service --> - <script key="stockquoteScript" function="transformRequest"/> + <script language="rb" key="stockquoteScript" function="transformRequest"/> <!-- send message to real endpoint referenced by name "stockquote" and stop --> <send> - <endpoint ref="stockquote"/> + <endpoint key="stockquote"/> </send> - </in> + </in> - <out> + <out> <!-- transform the standard response back into the custom format the client expects --> - <script key="stockquoteScript" function="transformResponse"/> + <script language="rb" key="stockquoteScript" function="transformResponse"/> <!-- now send the custom response back to the client and stop --> <send/> - </out> - </rules> + </out> + -</synapse> </pre> +</definitions> </pre> <p><strong>Objective: Script mediators using Ruby</strong></p>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
