You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by in...@apache.org on 2007/12/17 10:58:38 UTC
svn commit: r604810 - in /webservices/synapse/trunk/java:
repository/conf/sample/synapse_sample_300.xml
repository/conf/sample/synapse_sample_354.xml
src/site/resources/Synapse_Samples.html
Author: indika
Date: Mon Dec 17 01:58:28 2007
New Revision: 604810
URL: http://svn.apache.org/viewvc?rev=604810&view=rev
Log:
add the Ruby sample (in-lined ruby script ) and update the sample guide
Added:
webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_354.xml
Modified:
webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_300.xml
webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html
Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_300.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_300.xml?rev=604810&r1=604809&r2=604810&view=diff
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_300.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_300.xml Mon Dec 17 01:58:28 2007
@@ -38,9 +38,9 @@
</in>
<out>
<log level="custom">
- <property name="Stock Quote on" expression="//ns:return/ns:lastTradeTimestamp/child::text()" xmlns:ns="http://services.samples/xsd"/>
- <property name="For the organization" expression="//ns:return/ns:name/child::text()" xmlns:ns="http://services.samples/xsd"/>
- <property name="Last Value" expression="//ns:return/ns:last/child::text()" xmlns:ns="http://services.samples/xsd"/>
+ <property name="Stock_Quote_on" expression="//ns:return/ns:lastTradeTimestamp/child::text()" xmlns:ns="http://services.samples/xsd"/>
+ <property name="For_the_organization" expression="//ns:return/ns:name/child::text()" xmlns:ns="http://services.samples/xsd"/>
+ <property name="Last_Value" expression="//ns:return/ns:last/child::text()" xmlns:ns="http://services.samples/xsd"/>
</log>
</out>
Added: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_354.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_354.xml?rev=604810&view=auto
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_354.xml (added)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_354.xml Mon Dec 17 01:58:28 2007
@@ -0,0 +1,52 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+ <!-- Using In-lined Ruby scripts for mediation -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+ <in>
+ <script language="rb">
+ <![CDATA[
+ require 'rexml/document'
+ include REXML
+ newRequest= Document.new '<m:getQuote xmlns:m="http://services.samples/xsd"><m:request><m:symbol>...test...</m:symbol></m:request></m:getQuote>'
+ newRequest.root.elements[1].elements[1].text = $mc.getPayloadXML().root.elements[1].get_text
+ $mc.setPayloadXML(newRequest)
+ ]]>
+ </script>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </in>
+ <out>
+ <script language="rb">
+ <![CDATA[
+ require 'rexml/document'
+ include REXML
+ newResponse = Document.new '<m:CheckPriceResponse xmlns:m="http://services.samples/xsd"><m:Code></m:Code><m:Price></m:Price></m:CheckPriceResponse>'
+ newResponse.root.elements[1].text = $mc.getPayloadXML().root.elements[1].elements[1].get_text
+ newResponse.root.elements[2].text = $mc.getPayloadXML().root.elements[1].elements[2].get_text
+ $mc.setPayloadXML(newResponse)
+ ]]>
+ </script>
+ <send/>
+ </out>
+</definitions>
+
Modified: webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html?rev=604810&r1=604809&r2=604810&view=diff
==============================================================================
--- webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html (original)
+++ webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html Mon Dec 17 01:58:28 2007
@@ -235,6 +235,7 @@
context API methods using scripting language</a></li>
<li><a href="#Sample353">Sample 353: Using Ruby scripts for
mediation</a></li>
+<li><a href="#Sample354">Sample 354: Using In-lined Ruby scripts for mediation</a></li>
</ul>
</li>
<li><a href="#DBMediators">Database interactions in mediation (DBLookup
@@ -282,10 +283,10 @@
</ul>
</li>
<!--<li><a href="#Aggregator">Aggregating messages and process in batch</a> -->
- <!--<ul>-->
- <!--<li><a href="#Sample410">Sample 410: Message splitting and-->
- <!--aggregating the responses</a></li>-->
- <!--</ul>-->
+ <!--<ul>-->
+ <!--<li><a href="#Sample410">Sample 410: Message splitting and-->
+ <!--aggregating the responses</a></li>-->
+ <!--</ul>-->
<!--</li>-->
<li><a href="#Cache">Caching the responses over the requests</a>
<ul>
@@ -2909,9 +2910,9 @@
</in>
<out>
<log level="custom">
- <property name="Stock Quote on" expression="//ns:return/ns:lastTradeTimestamp/child::text()" xmlns:ns="http://services.samples/xsd"/>
- <property name="For the organization" expression="//ns:return/ns:name/child::text()" xmlns:ns="http://services.samples/xsd"/>
- <property name="Last Value" expression="//ns:return/ns:last/child::text()" xmlns:ns="http://services.samples/xsd"/>
+ <property name="Stock_Quote_on" expression="//ns:return/ns:lastTradeTimestamp/child::text()" xmlns:ns="http://services.samples/xsd"/>
+ <property name="For_the_organization" expression="//ns:return/ns:name/child::text()" xmlns:ns="http://services.samples/xsd"/>
+ <property name="Last_Value" expression="//ns:return/ns:last/child::text()" xmlns:ns="http://services.samples/xsd"/>
</log>
</out>
@@ -3170,6 +3171,65 @@
the stock quote client to send a custom stock quote as per example #500 and
check the received stock quote response.</p>
+<h2><a name="Sample354">Sample 354: Using In-lined Ruby scripts for
+mediation</a></h2>
+
+<div>
+<pre> <!-- Using In-lined Ruby scripts for mediation -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+ <in>
+ <script language="rb">
+ <![CDATA[
+ require 'rexml/document'
+ include REXML
+ newRequest= Document.new '<m:getQuote xmlns:m="http://services.samples/xsd"><m:request><m:symbol>...test...</m:symbol></m:request></m:getQuote>'
+ newRequest.root.elements[1].elements[1].text = $mc.getPayloadXML().root.elements[1].get_text
+ $mc.setPayloadXML(newRequest)
+ ]]>
+ </script>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </in>
+ <out>
+ <script language="rb">
+ <![CDATA[
+ require 'rexml/document'
+ include REXML
+ newResponse = Document.new '<m:CheckPriceResponse xmlns:m="http://services.samples/xsd"><m:Code></m:Code><m:Price></m:Price></m:CheckPriceResponse>'
+ newResponse.root.elements[1].text = $mc.getPayloadXML().root.elements[1].elements[1].get_text
+ newResponse.root.elements[2].text = $mc.getPayloadXML().root.elements[1].elements[2].get_text
+ $mc.setPayloadXML(newResponse)
+ ]]>
+ </script>
+ <send/>
+ </out>
+</definitions> </pre>
+
+<p><strong>Objective: Script mediators using Ruby(In-line Ruby
+Script)</strong></p>
+
+<p><strong>Prerequisites:</strong></p>
+
+<p>This sample uses Ruby so first setup support for this in Synapse as
+described at <a href="Synapse_Samples_Setup.html#script">Configuring
+JRuby</a>. </p>
+
+<p>Start the Synapse configuration numbered 354: i.e. bin/synapse -sample
+354<br>
+Start the Axis2 server and deploy the SimpleStockQuoteService if not already
+done</p>
+
+<p></p>
+
+<p>This sample is functionally equivalent to the sample 353. </p>
+
+<p>Run the client with </p>
+<pre> ant stockquote -Daddurl=http://localhost:9000/soap/SimpleStockQuoteService -Dtrpurl=http://localhost:8080/ -Dmode=customquote</pre>
+</div>
+
<h2><a name="DBMediators">Database interactions in mediation (DBLookup /
DBReport)</a></h2>
@@ -4218,9 +4278,8 @@
observing a constant rate as the response to the client instead of the random
rate, which changes by each and every 20 seconds.</p>
-<p> </p>
-
-<p> </p>
+<p> </p>
+<p> </p>
</body>
</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org