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 @@ - - - + + + 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 @@ + + + + + + + + +
+ + + + + + + + + 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
  • Sample 353: Using Ruby scripts for mediation
  • +
  • Sample 354: Using In-lined Ruby scripts for mediation
  • Database interactions in mediation (DBLookup @@ -282,10 +283,10 @@
  • - - - - + + + +
  • Caching the responses over the requests
      @@ -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.

      +

      Sample 354: Using In-lined Ruby scripts for +mediation

      + +
      +
            <!-- 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> 
      + +

      Objective: Script mediators using Ruby(In-line Ruby +Script)

      + +

      Prerequisites:

      + +

      This sample uses Ruby so first setup support for this in Synapse as +described at Configuring +JRuby.

      + +

      Start the Synapse configuration numbered 354: i.e. bin/synapse -sample +354
      +Start the Axis2 server and deploy the SimpleStockQuoteService if not already +done

      + +

      + +

      This sample is functionally equivalent to the sample 353.

      + +

      Run the client with

      +
       ant stockquote -Daddurl=http://localhost:9000/soap/SimpleStockQuoteService -Dtrpurl=http://localhost:8080/ -Dmode=customquote
      +
      +

      Database interactions in mediation (DBLookup / DBReport)

      @@ -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.

      -

       

      - -

       

      +

       

      +

       

      --------------------------------------------------------------------- To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org For additional commands, e-mail: synapse-dev-help@ws.apache.org