From synapse-dev-return-5316-apmail-ws-synapse-dev-archive=ws.apache.org@ws.apache.org Mon Dec 17 09:59:04 2007 Return-Path: Delivered-To: apmail-ws-synapse-dev-archive@www.apache.org Received: (qmail 40743 invoked from network); 17 Dec 2007 09:59:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Dec 2007 09:59:04 -0000 Received: (qmail 60116 invoked by uid 500); 17 Dec 2007 09:58:53 -0000 Delivered-To: apmail-ws-synapse-dev-archive@ws.apache.org Received: (qmail 60073 invoked by uid 500); 17 Dec 2007 09:58:53 -0000 Mailing-List: contact synapse-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: synapse-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list synapse-dev@ws.apache.org Received: (qmail 60062 invoked by uid 500); 17 Dec 2007 09:58:53 -0000 Delivered-To: apmail-ws-synapse-cvs@ws.apache.org Received: (qmail 60059 invoked by uid 99); 17 Dec 2007 09:58:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Dec 2007 01:58:53 -0800 X-ASF-Spam-Status: No, hits=-98.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Dec 2007 09:58:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CFAA01A984E; Mon, 17 Dec 2007 01:58:39 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: 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 Date: Mon, 17 Dec 2007 09:58:38 -0000 To: synapse-cvs@ws.apache.org From: indika@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071217095839.CFAA01A984E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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