You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by as...@apache.org on 2007/03/08 09:50:07 UTC

svn commit: r515973 - in /webservices/synapse/trunk/java: repository/conf/ repository/conf/sample/ repository/conf/sample/resources/ src/site/resources/

Author: asankha
Date: Thu Mar  8 00:50:06 2007
New Revision: 515973

URL: http://svn.apache.org/viewvc?view=rev&rev=515973
Log:
update samples 0 to 3 to new syntax and update sample documentation

Modified:
    webservices/synapse/trunk/java/repository/conf/sample/resources/synapse.xml
    webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_1.xml
    webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_2.xml
    webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml
    webservices/synapse/trunk/java/repository/conf/synapse.xml
    webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html

Modified: webservices/synapse/trunk/java/repository/conf/sample/resources/synapse.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/resources/synapse.xml?view=diff&rev=515973&r1=515972&r2=515973
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/resources/synapse.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/resources/synapse.xml Thu Mar  8 00:50:06 2007
@@ -17,14 +17,12 @@
   ~  under the License.
   -->
 
-<synapse xmlns="http://ws.apache.org/ns/synapse">
+<!-- a registry based Synapse configuration -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+    
+    <log level="custom">
+        <property name="message" value="This is a dynamic Synapse configuration"/>
+    </log>
+    <send/>
 
-    <!-- a registry based Synapse configuration -->
-    <rules>
-        <log level="custom">
-            <property name="message" value="This is a fully dynamic configuration"/>
-        </log>
-        <send/>
-    </rules>
-
-</synapse> 
\ No newline at end of file
+</definitions>
\ No newline at end of file

Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_1.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_1.xml?view=diff&rev=515973&r1=515972&r2=515973
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_1.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_1.xml Thu Mar  8 00:50:06 2007
@@ -17,25 +17,21 @@
   ~  under the License.
   -->
 
-<synapse xmlns="http://ws.apache.org/ns/synapse">
+<!-- simple content based routing of messages -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
 
-    <!-- simple content based routing of messages -->
-    <rules>
+    <!-- simple filtering of messages with XPath and regex matches -->
+    <filter source="get-property('To')" regex=".*/StockQuote.*">
 
-        <!-- simple filtering of messages with XPath and regex matches -->
-        <filter source="get-property('To')" regex=".*/StockQuote.*">
+        <!-- route the message to the SimpleStockQuoteService1 service EPR -->
+        <send>
+            <endpoint>
+                <address uri="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
+            </endpoint>
+        </send>
+    </filter>
 
-            <!-- route the message to the SimpleStockQuoteService1 service EPR -->
-            <send>
-                <endpoint>
-                    <address uri="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
-                </endpoint>
-            </send>
-        </filter>
+    <!-- send any other messages without change -->
+    <send/>
 
-        <!-- send any other messages without change -->
-        <send/>
-
-    </rules>
-
-</synapse> 
\ No newline at end of file
+</definitions> 
\ No newline at end of file

Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_2.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_2.xml?view=diff&rev=515973&r1=515972&r2=515973
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_2.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_2.xml Thu Mar  8 00:50:06 2007
@@ -17,39 +17,35 @@
   ~  under the License.
   -->
 
-<synapse xmlns="http://ws.apache.org/ns/synapse">
+<!-- switch-case mediator and setting and reading of local properties on a message -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
 
-    <!-- switch-case mediator and setting and reading of local properties on a message -->
-    <rules>
+    <!-- introduction to switch-case-default mediator -->
+    <switch source="//m0:getQuote/m0:request/m0:symbol" xmlns:m0="http://services.samples/xsd">
+        <case regex="IBM">
+            <!-- the property mediator sets a local property on the *current* message -->
+            <property name="symbol" value="Great stock - IBM"/>
+        </case>
+        <case regex="MSFT">
+            <property name="symbol" value="Are you sure? - MSFT"/>
+        </case>
+        <default>
+            <!-- it is possible to assign the result of an XPath expression as well -->
+            <property name="symbol"
+                  expression="fn:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"
+                  xmlns:m0="http://services.samples/xsd"/>
+        </default>
+    </switch>
+
+    <log level="custom">
+        <!-- the get-property() XPath extension function allows the lookup of local message properties
+            as well as properties from the Axis2 or Transport contexts (i.e. transport headers) -->
+        <property name="symbol" expression="get-property('symbol')"/>
+        <!-- the get-property() function supports the implicit message headers To/From/Action/FaultTo/ReplyTo -->
+        <property name="epr" expression="get-property('To')"/>
+    </log>
 
-        <!-- introduction to switch-case-default mediator -->
-        <switch source="//m0:getQuote/m0:request/m0:symbol" xmlns:m0="http://services.samples/xsd">
-            <case regex="IBM">
-                <!-- the set-property sets a local property on the current message-->
-                <!-- its value could be set as a static string as follows -->
-                <set-property name="symbol" value="Great stock - IBM"/>
-            </case>
-            <case regex="MSFT">
-                <set-property name="symbol" value="Are you sure? - MSFT"/>
-            </case>
-            <default>
-                <!-- it is possible to assign the result of an XPath expression as the value of a message property -->
-                <set-property name="symbol"
-                      expression="fn:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"
-                      xmlns:m0="http://services.samples/xsd"/>
-            </default>
-        </switch>
+    <!-- Send the messages where they are destined to (i.e. the 'To' EPR of the message) -->
+    <send/>
 
-        <log level="custom">
-            <!-- the get-property() XPath extension function allows the lookup of local message properties -->
-            <property name="symbol" expression="get-property('symbol')"/>
-            <!-- the get-property() function supports the implicit message headers To/From/Action/FaultTo/ReplyTo -->
-            <property name="epr" expression="get-property('To')"/>
-        </log>
-
-        <!-- Send the messages where they are destined to (i.e. the 'To' EPR of the message) -->
-        <send/>
-
-    </rules>
-
-</synapse>
\ No newline at end of file
+</definitions>
\ No newline at end of file

Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml?view=diff&rev=515973&r1=515972&r2=515973
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml Thu Mar  8 00:50:06 2007
@@ -17,67 +17,42 @@
   ~  under the License.
   -->
 
-<synapse xmlns="http://ws.apache.org/ns/synapse">
+<!-- illustration of local registry entry definitions, and reusable endpoints and sequences -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
 
-    <!-- illustration of simple properties, and reusable endpoints and sequences -->
-    <definitions>
+    <!-- define a string resource entry to the local registry -->
+    <localEntry key="version">0.1</localEntry>
 
-        <!-- define a string literal property -->
-        <set-property name="version" value="0.1"/>
+    <!-- define a reuseable endpoint definition -->
+    <endpoint name="simple">
+        <address uri="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
+    </endpoint>
+
+    <!-- define a reusable sequence -->
+    <sequence name="stockquote">
+
+        <!-- log the message using the custom log level. illustrates custom properties for log -->
+        <log level="custom">
+            <property name="Text" value="Sending quote request"/>
+            <property name="version" expression="get-property('version')"/>
+            <property name="direction" expression="get-property('direction')"/>
+        </log>
+
+        <!-- send message to real endpoint referenced by key "simple" endpoint definition -->
+        <send>
+            <endpoint key="simple"/>
+        </send>
+    </sequence>
+
+    <sequence name="main">
+        <in>
+            <property name="direction" value="incoming"/>
+            <sequence key="stockquote"/>
+        </in>
+        <out>
+            <!-- Send the messages where they have been sent (i.e. implicit To EPR) -->
+            <send/>
+        </out>
+    </sequence>
 
-        <!-- define a reuseable endpoint definition -->
-        <endpoint name="simple"
-                  address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
-
-        <!-- define a reusable sequence -->
-        <sequence name="stockquote">
-
-            <!-- log the message using the custom log level. illustrates custom properties for log messages -->
-            <log level="custom">
-                <property name="Text" value="Sending quote request"/>
-                <property name="version" expression="get-property('version')"/>
-                <property name="symbol" expression="get-property('symbol')"/>
-            </log>
-
-            <!-- send message to real endpoint referenced by name "stockquote" endpoint definition -->
-            <send>
-                <endpoint ref="simple"/>
-            </send>
-        </sequence>
-    </definitions>
-
-    <rules>
-
-        <!-- match the 'To' EPR to the given regex -->
-        <filter source="get-property('To')" regex=".*/SimpleStockQuoteService.*">
-
-            <!-- set a custom local message property based on the stock code requested -->
-            <switch source="//m0:getQuote/m0:request/m0:symbol"
-                    xmlns:m0="http://services.samples/xsd">
-                <case regex="IBM">
-                    <set-property name="symbol" value="Great stock - IBM"/>
-                </case>
-                <case regex="MSFT">
-                    <set-property name="symbol" value="Are you sure? - MSFT"/>
-                </case>
-                <default>
-                    <!-- it is possible to assign the result of an XPath expression as the value of a local message property -->
-                    <set-property name="symbol"
-                                  expression="fn:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"
-                                  xmlns:m0="http://services.samples/xsd"/>
-                </default>
-            </switch>
-
-            <!-- invoke an already defined [reusable] sequence at this point -->
-            <sequence ref="stockquote"/>
-        </filter>
-
-        <!-- Log all messages passing through -->
-        <log level="full"/>
-
-        <!-- Send the messages where they have been sent (i.e. implicit To EPR) -->
-        <send/>
-
-    </rules>
-
-</synapse> 
\ No newline at end of file
+</definitions>

Modified: webservices/synapse/trunk/java/repository/conf/synapse.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/synapse.xml?view=diff&rev=515973&r1=515972&r2=515973
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/synapse.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/synapse.xml Thu Mar  8 00:50:06 2007
@@ -17,15 +17,13 @@
   ~  under the License.
   -->
 
-<synapse xmlns="http://ws.apache.org/ns/synapse">
+<!-- A simple Synapse configuration -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
   
-  <!-- The most simple Synapse configuration -->
-  <rules>
   	<!-- Log all messages passing through -->
   	<log level="full"/>
   	
-  	<!-- Send the messages where they have been sent (i.e. implicit To EPR) -->
+  	<!-- Send the messages where they have been sent (i.e. implicit "To" EPR) -->
   	<send/>
-  </rules>
 
-</synapse> 
\ No newline at end of file
+</definitions>
\ No newline at end of file

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?view=diff&rev=515973&r1=515972&r2=515973
==============================================================================
--- webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html (original)
+++ webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html Thu Mar  8 00:50:06 2007
@@ -119,29 +119,36 @@
 
 <h2><a name="Overview">Overview</a></h2>
 
-<p>To run the samples bundled with the Synapse distribution you will need Ant
-1.5 or later. Ant can be downloaded from http://ant.apache.org. The samples
-now come with a built in Axis2 server to host the service endpoints used in
-the samples, along with simple ant scripts to build and deploy the services
-into this Axis2 instance.</p>
+<p>The Synapse samples consists of various configurations that illustrate how
+Synapse could be configured and used to solve different problems. They come
+with a set of sample Web service clients, and a sample Axis2 server where the
+sample Web services could be hosted. It is also possible to easily startup
+any of the sample configurations using the synapse.sh/bat scripts and passing
+the sample number as an argument. You will need a JDK version 1.4 or higher
+to use Synapse, while any samples that uses HTTPS requires a version 1.5 or
+later. You will also need Ant 1.5 or later to build the sample services and
+run the sample clients. Ant can be downloaded from http://ant.apache.org. The
+other dependencies that are specific to some of the samples are documented
+where relevant.</p>
 
 <h2><a name="Axis2Server">Starting the Axis2 Server</a></h2>
 
 <p>To start the bundled Axis2 server, go to the samples/axis2Server directory
 and execute the axis2server.sh or axis2server.bat script. This starts the
-Axis2 server with the HTTP transport listener on port 9000.</p>
+Axis2 server with the HTTP transport listener on port 9000 and HTTPS on 9002
+respectively. </p>
 
-<p>Please note that the script picks up the correct config from the
-AXIS2_HOME directory, so please ensure this isn't set, or points to the
-samples/axis2Server directory.</p>
-
-<p>The sample services are available in the samples/axis2Server/src
-directory. To deploy these services go the the selected directory and run
-'ant'. This will build the service archive file (aar) and deploy it into the
-Axis2 server. (i.e. copy it to the
-samples/axis2Server/repository\services)</p>
+<p>A set of sample Web services have been made available, so that the sample
+scenarios could be illustrated with end-to-end samples. The source for each
+of these services could be found in the samples/axis2Server/src directory. To
+deploy these services go the directory of the service selected (e.g.
+SimpleStockQuoteService) and execute the default Ant target as ''ant'. This
+will build the service archive file (aar) for the selected service and deploy
+it (i.e. copy it to the samples/axis2Server/repository/services) directly
+onto the sample Axis2 servers' repository, so that the service would be
+hosted on the Axis2 server instance. </p>
 
-<p>For example, to deploy the SimpleStockQuoteService service go to the
+<p>e.g. To deploy the SimpleStockQuoteService service go to the
 samples/axis2Server/src/SimpleStockQuoteService and execute 'ant' without any
 arguments as follows:</p>
 <pre>C:\Java\synapse\samples\axis2Server\src\SimpleStockQuoteService&gt;ant<br>Buildfile: build.xml
@@ -149,11 +156,13 @@
 [jar] Building jar: C:\Java\synapse\samples\axis2Server\repository\services\SimpleStockQuoteService.aar
 BUILD SUCCESSFUL</pre>
 
-<h2><a name="SampleServices">Descriptions of sample Services</a></h2>
+<h2><a name="SampleServices11" id="SampleServices11">Descriptions of sample
+Services</a></h2>
 <ol>
   <li>SimpleStockQuoteService - This service has two operations, getQuote
-    (in/out) and placeOrder (in-only). It will generate a sample stock quote
-    for a given symbol.</li>
+    (in-out) and placeOrder (in-only). The getQuote operation will generate a
+    sample stock quote for a given symbol, and the placeOrder operation will
+    accept a one way message for an order.</li>
   <li>SimpleStockQuoteService1 - This has the same functionality as the
     SimpleStockQuoteService service, but exists to make available a different
     service instance/EPR to demonstrating routing</li>
@@ -163,51 +172,53 @@
     signatures and encryption</li>
 </ol>
 
+<h2><a name="SampleServices" id="SampleServices">Samples using JMS</a></h2>
+
+<p>** TODO</p>
+
+<h2><a name="SampleServices1" id="SampleServices1">Samples using
+WS-Security</a></h2>
+
+<p>** TODO</p>
+
+<p></p>
+
 <h2><a name="StartingSynapse">Starting Synapse</a></h2>
 
 <p>To start Synapse with the default configuration execute the synapse.bat or
-synapse.sh script in the bin directory. This starts up an instance of Synapse
-using the Synapse and Axis2 configuration files located at repository/conf</p>
+synapse.sh script found in the /bin directory. This starts up an instance of
+Synapse using the Synapse and Axis2 configuration files located at
+repository/conf</p>
 
 <p>To start specific sample configurations of Synapse, use the -sample
-&lt;number&gt; switch as follows: <br>
+&lt;number&gt; argument as follows: <br>
 </p>
-<pre>bin\synapse.bat -sample &lt;number&gt;</pre>
+<pre>synapse.bat -sample &lt;number&gt;           OR             synapse.sh -sample &lt;number&gt;</pre>
 
-<p>The above on a Windows system will use the sample synapse.xml
-configuration file located at
-repository\conf\sample\synapse_sample_&lt;number&gt;.xml</p>
+<p>The above command will use the sample_synapse_&lt;number&gt;.xml
+configuration file found in the repository/conf/sample directory.</p>
 
 <h2><a name="SampleClients">Invoking the sample clients</a></h2>
 
 <p>The clients are located in the samples/axis2Client directory, and should
 be executed with the ant script supplied. (e.g. ant stockquote) The ant
-script expects an argument to select the client scenario to be executed. The
-samples/axis2Client/client_repo directory contains an Axis2 client repository
-along with the necessary modules and dependencies to make available
-WS-Addressing, WS-Security (Rampart) and WS-Reliable Messaging (Sandesha2) on
-the client side.</p>
+script is able to invoke different clients using different targets, which may
+expect optional arguments where relevant. The samples/axis2Client/client_repo
+directory contains an Axis2 client repository along with the necessary
+modules.</p>
 
 <h1><a name="MediationSamples">Message Mediation Samples</a></h1>
 
 <h2><a name="Sample0">Sample 0:</a></h2>
-<pre>&lt;synapse xmlns="http://ws.apache.org/ns/synapse"&gt;
-    &lt;!-- simple Synapse configuration --&gt;
-    &lt;rules&gt;
-        &lt;!-- log all attributes of messages passing through --&gt;
-        &lt;log level="full"/&gt;
+<pre>&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+  
+  &lt;!-- Log all messages passing through --&gt;
+  &lt;log level="full"/&gt;
+  
+  &lt;!-- Send the messages where they have been sent (i.e. implicit "To" EPR) --&gt;
+  &lt;send/&gt;
 
-        &lt;!-- Send the messages where they are destined to (i.e. the 'To' EPR of the message) --&gt;
-        &lt;send/&gt;
-
-        &lt;!-- a send or drop mediator [currently] terminates further processing of the current message --&gt;
-        &lt;!-- hence the following mediatior will not be invoked on any message --&gt;
-        &lt;log level="custom"&gt;
-            &lt;!-- the log mediator allows custom attributes/properties for a log message. --&gt;
-            &lt;property name="message" value="You should not see this"/&gt;
-        &lt;/log&gt;
-    &lt;/rules&gt;
-&lt;/synapse&gt; </pre>
+&lt;/definitions&gt; </pre>
 
 <p><strong>Objective: Introduction to Synapse. Shows how a message could be
 made to pass through Synapse </strong><strong>and logged before it is
@@ -218,89 +229,88 @@
   <li>Smart Client mode</li>
 
   <p>In this mode, the client addresses its messages to the ultimate receiver
-  of the message using WS-Addressing, but specifies the transport URL to
-  Synapse. This results in the messages reaching Synapse with the
-  WS-Addressing information which could be used to route the message as
-  appropriate.</p>
-  <li>Synapse as a Proxy</li>
+  of the message using WS-Addressing, but specifies the transport URL to that
+  of Synapse. This results in the messages reaching Synapse through the
+  transport, with the WS-Addressing information specifying the ultimate
+  destination EPR that could be used to route the message as appropriate.</p>
+  <li>Using Synapse as a HTTP Proxy</li>
 
-  <p>In this mode, the client sets Synapse as an HTTP Proxy but sets the
+  <p>In this mode, the client sets Synapse as an HTTP Proxy and sets the
   destination EPR to indicate the ultimate receiver of the message. This
-  forces all outgoing HTTP messages to flow into Synapse, which will then
-  send the messages as appropriate.</p>
+  forces all outgoing HTTP messages to flow into Synapse, which will then be
+  able to intercept and mediate the messages and route them as
+  appropriate.</p>
   <li>Dumb Client</li>
 
-  <p>In this mode, the client expects Synapse to decide on the destination of
-  the message through appropriate routing rules using the content of the
-  message.</p>
+  <p>In this mode, the client expects Synapse to decide on the destination
+  EPR of the message through appropriate mediation/routing rules, and hence
+  addresses the messages to the Synapse instance.</p>
 </ol>
 
 <p><strong>Pre-Requisites:<br>
-</strong>Start the Synapse configuration numbered 0: i.e. synapse -sample
+</strong>Start the Synapse configuration numbered 0: e.g. synapse.sh -sample
 0<br>
 Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps
 above)</p>
 
 <p><strong>Execute the Smart Client as 'ant stockquote'<br>
-</strong>Client: samples.userguide.StockQuoteClient</p>
+</strong>Client Code: samples.userguide.StockQuoteClient</p>
 
-<p>If you follow through the execution of Synapse mediation rules while
-looking at the configuration used synapse_sample_0.xml you will notice that
-the client request arrived at Synapse with a WS-Addressing 'To' EPR of
+<p>By following through the execution of Synapse through the DEBUG level log
+output to the system output stream (i.e. console), you will notice that the
+client request arrived at Synapse with a WS-Addressing 'To' EPR of
 http://localhost:9000/axis2/services/SimpleStockQuoteService</p>
 
-<p>The Synapse configuration logs the message at the highest log level as the
-configuration specifies the log level as 'full'. Then Synapse sends the
-message using the implicit 'To' address of the message - which is
+<p>The Synapse engine now logs the message at the "full" log level (i.e. all
+message headers and the body) and sends the message to its implicit 'To'
+address - which is
 http://localhost:9000/axis2/services/SimpleStockQuoteService</p>
 
-<p>Then you will see on the Axis2 server console, a message similar to the
-following<br>
-</p>
+<p>Then you will see on the Axis2 server console, a message confirming that
+the message got routed to the sample server and the sample service that was
+invoked generated a sample stock quote for the requested symbol.</p>
 <pre>Sat Nov 18 21:01:23 IST 2006 SimpleStockQuoteService :: Generating quote for : IBM</pre>
 
-<p>This shows that Synapse forwarded the message to the intended recepient
-after logging the message and then the actual service received and processed
-it. The response message generated is again received at Synapse, and flows
-through the same mediation rules, which logs the message and then sends it -
-this time back to the client.</p>
+<p>The response message generated by the service is again received by
+Synapse, and flows through the same mediation rules, which logs the response
+message and then sends it back - this time to the client.</p>
 
 <p>On the client console you should see an output similar to the following
 based on the message received by the client.</p>
 <pre>Standard :: Stock price = $95.26454380258552</pre>
 
 <p><strong>Execute the Proxy client as 'ant proxystockquote'</strong><br>
-Client: samples.userguide.ProxyStockQuoteClient</p>
+Client Code: samples.userguide.ProxyStockQuoteClient</p>
 
 <p>You will see the exact same behaviour as per the previous example when you
 run this scenario. However this time the difference is at the client and
 would be noticable only if one looks at the source code of the example class
-samples.userguide.ProxyStockQuoteClient</p>
+samples.userguide.ProxyStockQuoteClient.</p>
 
 <h2><a name="Sample1">Sample 1:</a></h2>
-<pre>&lt;synapse xmlns="http://ws.apache.org/ns/synapse"&gt;
-    &lt;!-- simple content based routing of messages --&gt;
-    &lt;rules&gt;
+<pre>&lt;!-- simple content based routing of messages --&gt;
+&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
 
-        &lt;!-- simple filtering of messages with XPath and regex matches --&gt;
-        &lt;filter source="get-property('To')" regex=".*/StockQuote.*"&gt;
+    &lt;!-- simple filtering of messages with XPath and regex matches --&gt;
+    &lt;filter source="get-property('To')" regex=".*/StockQuote.*"&gt;
 
-            &lt;!-- route the message to the SimpleStockQuoteService1 service EPR --&gt;
-            &lt;send&gt;
-                &lt;endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/&gt;
-            &lt;/send&gt;
-        &lt;/filter&gt;
+        &lt;!-- route the message to the SimpleStockQuoteService1 service EPR --&gt;
+        &lt;send&gt;
+            &lt;endpoint&gt;
+                &lt;address uri="http://localhost:9000/axis2/services/SimpleStockQuoteService"/&gt;
+            &lt;/endpoint&gt;
+        &lt;/send&gt;
+    &lt;/filter&gt;
 
-        &lt;!-- send any other messages without change --&gt;
-        &lt;send/&gt;
+    &lt;!-- send any other messages without change --&gt;
+    &lt;send/&gt;
 
-    &lt;/rules&gt;
-&lt;/synapse&gt; </pre>
+&lt;/definitions&gt;  </pre>
 
 <p><strong>Objective: Introduction to simple content based routing. Shows how
 a message could be made to pass through Synapse using the Dumb Client mode,
 where Synapse acts as a gateway to accept all messages and then perform
-mediation and routing.</strong></p>
+mediation and routing based on message properties or content.</strong></p>
 
 <p><strong>Pre-Requisites:</strong><br>
 Start the Synapse configuration numbered 1: i.e. synapse -sample 1<br>
@@ -309,54 +319,53 @@
 </p>
 
 <p>Execute the Dumb Client as 'ant dumbstockquote'<br>
-Client: samples.userguide.DumbStockQuoteClient<br>
+Client Code: samples.userguide.DumbStockQuoteClient<br>
 </p>
 
 <p>This time you will notice that Synapse received a message for which
 Synapse was set as the ultimate receiver of the message. Based on the 'To'
-EPR, Synapse performed a match to the given path '/StockQuote' and as the
-request matched the XPath expression of the filter mediator, the filter
-mediators' child mediators executes, and thereby semding the message to a
-different endpoint as specified by the [reusable] endpoint definition.</p>
+EPR of http://localhost:8080/StockQuote, Synapse performes a match to the
+given path '/StockQuote' and as the request matched the XPath expression of
+the filter mediator, the filter mediators' child mediators executes, and
+thereby sending the message to a different endpoint as specified by the
+endpoint definition.</p>
 
 <h2><a name="Sample2">Sample 2:</a></h2>
-<pre>&lt;synapse xmlns="http://ws.apache.org/ns/synapse"&gt;
-    &lt;!-- switch-case mediator and setting and reading of local properties on a message --&gt;
-    &lt;rules&gt;
+<pre>&lt;!-- switch-case mediator and setting and reading of local properties on a message --&gt;
+&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
 
-        &lt;!-- introduction to switch-case-default mediator --&gt;
-        &lt;switch source="//m0:getQuote/m0:request/m0:symbol" xmlns:m0="http://services.samples/xsd"&gt;
-            &lt;case regex="IBM"&gt;
-                &lt;!-- the set-property sets a local property on the current message--&gt;
-                &lt;!-- its value could be set as a static string as follows --&gt;
-                &lt;set-property name="symbol" value="Great stock - IBM"/&gt;
-            &lt;/case&gt;
-            &lt;case regex="MSFT"&gt;
-                &lt;set-property name="symbol" value="Are you sure? - MSFT"/&gt;
-            &lt;/case&gt;
-            &lt;default&gt;
-                &lt;!-- it is possible to assign the result of an XPath expression as the value of a message property --&gt;
-                &lt;set-property name="symbol"
-                      expression="fn:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"
-                      xmlns:m0="http://services.samples/xsd"/&gt;
-            &lt;/default&gt;
-        &lt;/switch&gt;
+    &lt;!-- introduction to switch-case-default mediator --&gt;
+    &lt;switch source="//m0:getQuote/m0:request/m0:symbol" xmlns:m0="http://services.samples/xsd"&gt;
+        &lt;case regex="IBM"&gt;
+            &lt;!-- the property mediator sets a local property on the *current* message --&gt;
+            &lt;property name="symbol" value="Great stock - IBM"/&gt;
+        &lt;/case&gt;
+        &lt;case regex="MSFT"&gt;
+            &lt;property name="symbol" value="Are you sure? - MSFT"/&gt;
+        &lt;/case&gt;
+        &lt;default&gt;
+            &lt;!-- it is possible to assign the result of an XPath expression as well --&gt;
+            &lt;set-property name="symbol"
+                  expression="fn:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"
+                  xmlns:m0="http://services.samples/xsd"/&gt;
+        &lt;/default&gt;
+    &lt;/switch&gt;
+
+    &lt;log level="custom"&gt;
+        &lt;!-- the get-property() XPath extension function allows the lookup of local message properties
+            as well as properties from the Axis2 or Transport contexts (i.e. transport headers) --&gt;
+        &lt;property name="symbol" expression="get-property('symbol')"/&gt;
+        &lt;!-- the get-property() function supports the implicit message headers To/From/Action/FaultTo/ReplyTo --&gt;
+        &lt;property name="epr" expression="get-property('To')"/&gt;
+    &lt;/log&gt;
 
-        &lt;log level="custom"&gt;
-            &lt;!-- the get-property() XPath extension function allows the lookup of local message properties --&gt;
-            &lt;property name="symbol" expression="get-property('symbol')"/&gt;
-            &lt;!-- the get-property() function supports the implicit message headers To/From/Action/FaultTo/ReplyTo --&gt;
-            &lt;property name="epr" expression="get-property('To')"/&gt;
-        &lt;/log&gt;
+    &lt;!-- Send the messages where they are destined to (i.e. the 'To' EPR of the message) --&gt;
+    &lt;send/&gt;
 
-        &lt;!-- Send the messages where they are destined to (i.e. the 'To' EPR of the message) --&gt;
-        &lt;send/&gt;
-
-    &lt;/rules&gt;
-&lt;/synapse&gt;</pre>
+&lt;/definitions&gt;</pre>
 
 <p><strong>Objective: Introduce switch-case mediator and writing and reading
-of local properties on a message</strong></p>
+of local properties set on a message instance</strong></p>
 
 <p><strong>Pre-Requisites:</strong><br>
 Start the Synapse configuration numbered 2: i.e. synapse -sample 2<br>
@@ -367,100 +376,91 @@
 mediation rules executed you will see that the case statements' first case
 for 'IBM' executed and a local property named 'symbol' was set to 'Great
 stock - IBM'. Subsequently this local property value is looked up by the log
-mediator and logged. The message flowes through to Axis2 and then the reply
-back to the client.</p>
-
-<h2><a name="Sample3">Sample 3:</a></h2>
-<pre>&lt;synapse xmlns="http://ws.apache.org/ns/synapse"&gt;
+mediator and logged. The message flowes through to the service hosted on the
+sample Axis2 server and then the reply back to the client.</p>
+<pre>INFO LogMediator - symbol = Great stock - IBM, epr = http://localhost:9000/axis2/services/SimpleStockQuoteService </pre>
+
+<p>To test a stockquote request for another stock, say MSFT, use "ant
+stockquote -Dsymbol=MSFT"</p>
+<pre>INFO LogMediator - symbol = Are you sure? - MSFT, epr = http://localhost:9000/axis2/services/SimpleStockQuoteService</pre>
+
+<h2><a name="Sample3" id="Sample3">Sample 3:</a></h2>
+<pre>&lt;!-- illustration of local registry entry definitions, and reusable endpoints and sequences --&gt;
+&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;!-- define a string resource entry to the local registry --&gt;
+    &lt;localEntry key="version"&gt;0.1&lt;/localEntry&gt;
+
+    &lt;!-- define a reuseable endpoint definition --&gt;
+    &lt;endpoint name="simple"&gt;
+        &lt;address uri="http://localhost:9000/axis2/services/SimpleStockQuoteService"/&gt;
+    &lt;/endpoint&gt;
 
-    &lt;!-- illustration of simple properties, and reusable endpoints and sequences --&gt;
-    &lt;definitions&gt;
-
-        &lt;!-- define a string literal property --&gt;
-        &lt;set-property name="version" value="0.1"/&gt;
-
-        &lt;!-- define a reuseable endpoint definition --&gt;
-        &lt;endpoint name="simple"
-                  address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/&gt;
+    &lt;!-- define a reusable sequence --&gt;
+    &lt;sequence name="stockquote"&gt;
 
-        &lt;!-- define a reusable sequence --&gt;
-        &lt;sequence name="stockquote"&gt;
-
-            &lt;!-- log the message using the custom log level. illustrates custom properties for log messages --&gt;
-            &lt;log level="custom"&gt;
-                &lt;property name="Text" value="Sending quote request"/&gt;
-                &lt;property name="version" expression="get-property('version')"/&gt;
-                &lt;property name="symbol" expression="get-property('symbol')"/&gt;
-            &lt;/log&gt;
-
-            &lt;!-- send message to real endpoint referenced by name "stockquote" endpoint definition --&gt;
-            &lt;send&gt;
-                &lt;endpoint ref="simple"/&gt;
-            &lt;/send&gt;
-        &lt;/sequence&gt;
-    &lt;/definitions&gt;
-
-    &lt;rules&gt;
-
-        &lt;!-- match the 'To' EPR to the given regex --&gt;
-        &lt;filter source="get-property('To')" regex=".*/SimpleStockQuoteService.*"&gt;
-
-            &lt;!-- set a custom local message property based on the stock code requested --&gt;
-            &lt;switch source="//m0:getQuote/m0:request/m0:symbol"
-                    xmlns:m0="http://services.samples/xsd"&gt;
-                &lt;case regex="IBM"&gt;
-                    &lt;set-property name="symbol" value="Great stock - IBM"/&gt;
-                &lt;/case&gt;
-                &lt;case regex="MSFT"&gt;
-                    &lt;set-property name="symbol" value="Are you sure? - MSFT"/&gt;
-                &lt;/case&gt;
-                &lt;default&gt;
-                    &lt;!-- it is possible to assign the result of an XPath expression as the value of a local message property --&gt;
-                    &lt;set-property name="symbol"
-                                  expression="fn:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"
-                                  xmlns:m0="http://services.samples/xsd"/&gt;
-                &lt;/default&gt;
-            &lt;/switch&gt;
+        &lt;!-- log the message using the custom log level. illustrates custom properties for log --&gt;
+        &lt;log level="custom"&gt;
+            &lt;property name="Text" value="Sending quote request"/&gt;
+            &lt;property name="version" expression="get-property('version')"/&gt;
+            &lt;property name="direction" expression="get-property('direction')"/&gt;
+        &lt;/log&gt;
 
-            &lt;!-- invoke an already defined [reusable] sequence at this point --&gt;
-            &lt;sequence ref="stockquote"/&gt;
-        &lt;/filter&gt;
+        &lt;!-- send message to real endpoint referenced by key "simple" endpoint definition --&gt;
+        &lt;send&gt;
+            &lt;endpoint key="simple"/&gt;
+        &lt;/send&gt;
+    &lt;/sequence&gt;
 
-        &lt;!-- Log all messages passing through --&gt;
-        &lt;log level="full"/&gt;
+    &lt;sequence name="main"&gt;
+        &lt;in&gt;
+            &lt;property name="direction" value="incoming"/&gt;
+            &lt;sequence key="stockquote"/&gt;
+        &lt;/in&gt;
+        &lt;out&gt;
+            &lt;!-- Send the messages where they have been sent (i.e. implicit To EPR) --&gt;
+            &lt;send/&gt;
+        &lt;/out&gt;
+    &lt;/sequence&gt;
 
-        &lt;!-- Send the messages where they have been sent (i.e. implicit To EPR) --&gt;
-        &lt;send/&gt;
+&lt;/definitions&gt;
 
-    &lt;/rules&gt;
-&lt;/synapse&gt; </pre>
+ </pre>
 
-<p><strong>Objective: Illustrates simple properties, and reusable endpoints
-and sequences</strong></p>
+<p><strong>Objective: Illustrates local registry entry definitions, reusable
+endpoints and sequences</strong></p>
 
 <p><strong>Pre-Requisites:</strong><br>
 Start the Synapse configuration numbered 3: i.e. synapse -sample 3<br>
 Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps
 above)</p>
 
-<p>Execute the 'ant stockquote' request again. Following through the
-mediation logs you will see that once the filter and switch statments are
-through, the sequence named 'stockquote' is referenced and invoked. Also the
-log mediator dumps a string property, and two XPath evaluation results. The
-first expression fetches a local static string lieral property named
-'version'. This is a global property applicable to all messages passing
-through Synapse, and available for reading from any reusable sequence or the
-main rules. The second expression fetches the local message property named
-'symbol' which was set within the switch mediator, using the set-property
-mediator. However, for both expressions the 'get-property()' XPath extension
-function has been used. This function will first look for a given property
-within the local message, and if a property with the name cannot be found, it
-performs a lookup over all global properties. In addition, the get-property()
-function supports the special cases 'To', 'From', 'Action', 'FaultTo' and
-'ReplyTo', which fetches the appropriate values from the current message
-context.</p>
+<p>This example uses a sequence named as "main" that specifies the main
+mediation rules to be executed. This is equivalent to specifying the
+mediators of the main sequence within the &lt;definitions&gt; tags directly -
+but this is the reccomended and neater approach when the configuration
+becomes non trivial. </p>
+
+<p>Execute the 'ant stockquote' request again, and following through the
+mediation logs you will now notice that the sequence named "main" executed.
+Then for the incoming message flow the &lt;in&gt; mediator executes, and it
+calls into the sequence named "stockquote"</p>
+<pre>DEBUG SequenceMediator - Sequence mediator &lt;main&gt; :: mediate()<br>DEBUG InMediator - In mediator mediate()<br>DEBUG SequenceMediator - Sequence mediator &lt;stockquote&gt; :: mediate()</pre>
+<pre></pre>
+
+<p>As the "stockquote" sequence executes, the log mediator dumps a simple
+text/string property, an XPath evaluation result - that picks up the key
+named "version", and a second XPath evaluation result that picks up a local
+message property set previously by the &lt;property&gt; mediator. The
+get-property() XPath extension function is able to read message properties
+local to the current message, local or remote registry entries, Axis2 message
+context properties as well as transport headers. The local entry definition
+for "version" defines a simple text/string registry entry for that is visible
+to all messages that passes through Synapse.</p>
+
+<h2><a name="Sample4">HERE___</a></h2>
 
-<h2><a name="Sample4">Sample 4:</a></h2>
+<h2><a name="Sample41" id="Sample41">Sample 4:</a></h2>
 <pre>&lt;synapse xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;!-- illustration of various mediators : try-catch-finally and makefault mediators --&gt;
@@ -1194,11 +1194,12 @@
 
 <p>You will now notice that the message is forwarded to the specified target
 endpoint and the request was routed to the SimpleStockQuoteService service on
-the local Axis2 instance. The response message is forwarded to the client with
-the help of the implicit parameters, as an outgoing sequence is not specified
-in this example either. The client should receive a stock quote reply from the
-proxy service. Also the client could get the WSDL for the proxy service by
-requesting for http://localhost:8080/axis2/services/StockQuoteProxy?wsdl</p>
+the local Axis2 instance. The response message is forwarded to the client
+with the help of the implicit parameters, as an outgoing sequence is not
+specified in this example either. The client should receive a stock quote
+reply from the proxy service. Also the client could get the WSDL for the
+proxy service by requesting for
+http://localhost:8080/axis2/services/StockQuoteProxy?wsdl</p>
 
 <h2><a name="Sample101">Sample 101:</a></h2>
 <pre>&lt;synapse xmlns="http://ws.apache.org/ns/synapse"&gt;
@@ -1386,9 +1387,10 @@
 services through WS-Policy</strong></p>
 
 <p><strong>Pre-Requisites:</strong><br>
-Download and copy the BouncyCastle JAR and the Xalan JAR file into your Synapse lib directory.
-(Note: the exact BouncyCastle JAR you need to install depends on your JDK - for JDK 1.4 I
-have used bcprov-jdk13-132.jar and the xalan-2.7.0.jar)<br>
+Download and copy the BouncyCastle JAR and the Xalan JAR file into your
+Synapse lib directory. (Note: the exact BouncyCastle JAR you need to install
+depends on your JDK - for JDK 1.4 I have used bcprov-jdk13-132.jar and the
+xalan-2.7.0.jar)<br>
 Start the Synapse configuration numbered 103: i.e. synapse -sample 103<br>
 Copy the Apache Rampart module (e.g. rampart-1.1-SNAPSHOT.mar) into the
 modules directory of the sample Axis2 client
@@ -1422,12 +1424,12 @@
 
 <p>Using TCPMon, a sample request sent from the client to the WS-Security
 enabled proxy service has been captured as follows: <a
-href="sample_103_1.txt?content-type=text&view=co">sample_103_1.txt</a></p>
+href="sample_103_1.txt?content-type=text&amp;view=co">sample_103_1.txt</a></p>
 
 <p>Synapse removes the wsse:Security header from this message and forwards it
 to the endpoint. The response received is now signed and encrypted and sent
 back to the client as follows: <a
-href="sample_103_2.txt?content-type=text&view=co">sample_103_2.txt</a></p>
+href="sample_103_2.txt?content-type=text&amp;view=co">sample_103_2.txt</a></p>
 
 <h2><a name="Sample104">Sample 104:</a></h2>
 <pre>&lt;synapse xmlns="http://ws.apache.org/ns/synapse"&gt;



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