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/04/22 22:34:44 UTC
svn commit: r531267 - in /webservices/synapse/trunk/java:
modules/samples/src/main/java/samples/userguide/
modules/samples/src/main/scripts/ repository/conf/sample/ src/site/resources/
Author: asankha
Date: Sun Apr 22 13:34:41 2007
New Revision: 531267
URL: http://svn.apache.org/viewvc?view=rev&rev=531267
Log:
fix samples - take 3
Added:
webservices/synapse/trunk/java/src/site/resources/new_Synapse_Samples.html
Modified:
webservices/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java
webservices/synapse/trunk/java/modules/samples/src/main/scripts/build.xml
webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_0.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/sample/synapse_sample_4.xml
webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_5.xml
webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html
Modified: webservices/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java?view=diff&rev=531267&r1=531266&r2=531267
==============================================================================
--- webservices/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java (original)
+++ webservices/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/StockQuoteClient.java Sun Apr 22 13:34:41 2007
@@ -50,21 +50,21 @@
public static void main(String[] args) {
// defaults
- String symbol = "IBM";
- String mode = "quote";
- String addUrl = "http://localhost:9000/soap/SimpleStockQuoteService";
- String trpUrl = "http://localhost:8080";
+ String symbol = null;
+ String mode = null;
+ String addUrl = null;
+ String trpUrl = null;
String prxUrl = null;
- String repo = "client_repo";
+ String repo = null;
String svcPolicy = null;
- if (args.length > 0) symbol = args[0];
- if (args.length > 1) mode = args[1];
- if (args.length > 2) addUrl = args[2];
- if (args.length > 3) trpUrl = args[3];
- if (args.length > 4) prxUrl = args[4];
- if (args.length > 5) repo = args[5];
- if (args.length > 6) svcPolicy = args[6];
+ if (args.length > 0 && args[0].length()>0) symbol = args[0];
+ if (args.length > 1 && args[1].length()>0) mode = args[1];
+ if (args.length > 2 && args[2].length()>0) addUrl = args[2];
+ if (args.length > 3 && args[3].length()>0) trpUrl = args[3];
+ if (args.length > 4 && args[4].length()>0) prxUrl = args[4];
+ if (args.length > 5 && args[5].length()>0) repo = args[5];
+ if (args.length > 6 && args[6].length()>0) svcPolicy = args[6];
double price = 0; int quantity = 0;
Modified: webservices/synapse/trunk/java/modules/samples/src/main/scripts/build.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/samples/src/main/scripts/build.xml?view=diff&rev=531267&r1=531266&r2=531267
==============================================================================
--- webservices/synapse/trunk/java/modules/samples/src/main/scripts/build.xml (original)
+++ webservices/synapse/trunk/java/modules/samples/src/main/scripts/build.xml Sun Apr 22 13:34:41 2007
@@ -32,8 +32,8 @@
ant stockquote [-Dsymbol=IBM|MSFT|SUN|..]
[-Dmode=quote | customquote | fullquote | placeorder | marketactivity]
[-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService]
- [-Dtrourl=http://localhost:8080] [-Dprxurl=http://localhost:8080]
- [-Drepository=client_repo]
+ [-Dtrourl=http://localhost:8080]
+ [-Dprxurl=http://localhost:8080]
[-Dpolicy=../../repository/conf/sample/resources/policy/policy_1.xml]
Mode :
@@ -47,7 +47,7 @@
A client which could post a raw JMS text or binary message to a given destination.
examples:
- ant jmsclient [-Djms_payload="24.34 100 IBM"]
+ ant jmsclient [-Djms_type=text] [-Djms_dest=dynamicQueues/JMSTextProxy][-Djms_payload="24.34 100 IBM"]
ant jmsclient [-Djms_type=pox] [-Djms_dest=dynamicQueues/JMSPoxProxy] [-Djms_payload=MSFT]
ant jmsclient [-Djms_type=binary] [-Djms_dest=dynamicQueues/JMSFileUploadProxy]
[-Djms_payload=./../../repository/conf/sample/resources/mtom/asf-logo.gif]
@@ -64,13 +64,13 @@
<property name="symbol" value="IBM"/>
<property name="mode" value="quote"/>
- <property name="addurl" value="http://localhost:9000/soap/SimpleStockQuoteService"/>
- <property name="trpurl" value="http://localhost:8080"/>
- <property name="prxurl" value="http://localhost:8080/StockQuote"/>
+ <property name="addurl" value=""/>
+ <property name="trpurl" value=""/>
+ <property name="prxurl" value=""/>
<property name="repository" value="client_repo"/>
<property name="policy" value=""/>
- <property name="jms_dest" value="dynamicQueues/JMSTextProxy"/>
- <property name="jms_type" value="text"/>
+ <property name="jms_dest" value=""/>
+ <property name="jms_type" value=""/>
<property name="jms_payload" value=""/>
<property name="opt_mode" value="mtom"/>
<property name="opt_url" value="http://localhost:8080/soap/MTOMSwASampleService"/>
@@ -99,6 +99,20 @@
<arg value="${prxurl}"/>
<arg value="${repository}"/>
<arg value="${policy}"/>
+ </java>
+ </target>
+
+ <!-- a simple smoke test -->
+ <target name="smoke" depends="compile">
+ <java classname="samples.userguide.StockQuoteClient"
+ classpathref="javac.classpath" fork="true">
+ <arg value="IBM"/>
+ <arg value="quote"/>
+ <arg value="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <arg value="http://localhost:8080"/>
+ <arg value=""/>
+ <arg value="${repository}"/>
+ <arg value=""/>
</java>
</target>
Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_0.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_0.xml?view=diff&rev=531267&r1=531266&r2=531267
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_0.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_0.xml Sun Apr 22 13:34:41 2007
@@ -17,22 +17,10 @@
~ under the License.
-->
-<synapse xmlns="http://ws.apache.org/ns/synapse">
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+ <!-- log all attributes of messages passing through -->
+ <log level="full"/>
- <!-- simple Synapse configuration -->
- <rules>
- <!-- log all attributes of messages passing through -->
- <log level="full"/>
-
- <!-- Send the messages where they are destined to (i.e. the 'To' EPR of the message) -->
- <send/>
-
- <!-- a send or drop mediator [currently] terminates further processing of the current message -->
- <!-- hence the following mediatior will not be invoked on any message -->
- <log level="custom">
- <!-- the log mediator allows custom attributes/properties for a log message. -->
- <property name="message" value="You should not see this"/>
- </log>
- </rules>
-
-</synapse>
\ No newline at end of file
+ <!-- Send the messageto implicit destination -->
+ <send/>
+</definitions>
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=531267&r1=531266&r2=531267
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_1.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_1.xml Sun Apr 22 13:34:41 2007
@@ -19,19 +19,14 @@
<!-- simple content based routing of messages -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
-
- <!-- simple filtering of messages with XPath and regex matches -->
+ <!-- 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/soap/SimpleStockQuoteService"/>
</endpoint>
</send>
+ <drop/>
</filter>
-
- <!-- send any other messages without change -->
<send/>
-
</definitions>
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=531267&r1=531266&r2=531267
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_2.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_2.xml Sun Apr 22 13:34:41 2007
@@ -19,8 +19,6 @@
<!-- switch-case mediator and setting and reading of local properties on a message -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
-
- <!-- 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 -->
@@ -47,5 +45,4 @@
<!-- Send the messages where they are destined to (i.e. the 'To' EPR of the message) -->
<send/>
-
</definitions>
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=531267&r1=531266&r2=531267
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_3.xml Sun Apr 22 13:34:41 2007
@@ -19,10 +19,8 @@
<!-- illustration of local registry entry definitions, and reusable endpoints and sequences -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
-
<!-- define a string resource entry to the local registry -->
<localEntry key="version">0.1</localEntry>
-
<!-- define a reuseable endpoint definition -->
<endpoint name="simple">
<address uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
@@ -30,14 +28,12 @@
<!-- 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"/>
@@ -50,9 +46,7 @@
<sequence key="stockquote"/>
</in>
<out>
- <!-- Send the messages where they have been sent (i.e. implicit To EPR) -->
<send/>
</out>
</sequence>
-
</definitions>
Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_4.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_4.xml?view=diff&rev=531267&r1=531266&r2=531267
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_4.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_4.xml Sun Apr 22 13:34:41 2007
@@ -33,11 +33,15 @@
<log level="custom">
<property name="text" value="An unexpected error occured for stock SUN"/>
<property name="message" expression="get-property('ERROR_MESSAGE')"/>
+ <!--<property name="detail" expression="get-property('ERROR_DETAIL')"/>-->
</log>
- <drop/>
+ <makefault>
+ <code value="tns:Receiver" xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/>
+ <reason expression="get-property('ERROR_MESSAGE')"/>
+ </makefault>
+ <drop/>
</sequence>
- <!-- default message handling sequence used by Synapse - named 'main' -->
<sequence name="main">
<in>
<switch source="//m0:getQuote/m0:request/m0:symbol" xmlns:m0="http://services.samples/xsd">
Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_5.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_5.xml?view=diff&rev=531267&r1=531266&r2=531267
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_5.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_5.xml Sun Apr 22 13:34:41 2007
@@ -1,78 +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.
- -->
+<!-- introduction to error handling -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
-<synapse xmlns="http://ws.apache.org/ns/synapse">
+ <!-- the default fault handling sequence used by Synapse - named 'fault' -->
+ <sequence name="myFaultHandler">
+ <!-- create a custom fault message -->
+ <makefault>
+ <code value="tns:Receiver" xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/>
+ <reason expression="get-property('ERROR_MESSAGE')"/>
+ </makefault>
- <!-- error handling within a sequence using the 'onError' sequence -->
- <definitions>
-
- <!-- define an endpoint for the stock quote service -->
- <endpoint name="simple">
- <address uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
- </endpoint>
-
- <!-- define a non-existent endpoint to test error handling -->
- <endpoint name="bogus">
- <address uri="http://localhost:9009/soap/NonExistentStockQuoteService"/>
- </endpoint>
+ <property name="RESPONSE" value="true"/>
+ <header name="To" expression="get-property('ReplyTo')"/>
+ <send/>
+ </sequence>
- <!-- demonstrate the specification of an error handler sequence for a sequence -->
- <sequence name="stockquote" onError="errorHandler">
+ <!-- default message handling sequence used by Synapse - named 'main' -->
+ <sequence name="main" onError="myFaultHandler">
+ <in>
<switch source="//m0:getQuote/m0:request/m0:symbol"
xmlns:m0="http://services.samples/xsd">
<case regex="IBM">
<send>
- <endpoint ref="simple"/>
+ <endpoint name="simple">
+ <address uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ </endpoint>
</send>
</case>
<case regex="MSFT">
<send>
- <endpoint ref="bogus"/>
+ <endpoint name="bogusHost">
+ <address uri="http://bogus:9000/soap/NonExistentStockQuoteService"/>
+ </endpoint>
+ </send>
+ </case>
+ <case regex="SUN">
+ <send>
+ <endpoint name="bogusPort">
+ <address uri="http://localhost:9009/soap/NonExistentStockQuoteService"/>
+ </endpoint>
</send>
</case>
</switch>
- </sequence>
-
- <!-- define a sequence to be used for error handling -->
- <sequence name="errorHandler">
-
- <!-- Log the error -->
- <log level="custom">
- <property name="text" value="An unexpected error occured"/>
- <property name="message" expression="get-property('ERROR_MESSAGE')"/>
- <property name="detail" expression="get-property('ERROR_DETAIL')"/>
- </log>
-
- <!-- create a custom fault message -->
- <makefault>
- <code value="tns:Receiver" xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/>
- <reason expression="get-property('ERROR_MESSAGE')"/>
- </makefault>
+ <drop/>
+ </in>
+ <out>
<send/>
- </sequence>
-
- </definitions>
-
- <rules>
- <sequence ref="stockquote"/>
- <send/>
- </rules>
+ </out>
+ </sequence>
-</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=531267&r1=531266&r2=531267
==============================================================================
--- webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html (original)
+++ webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html Sun Apr 22 13:34:41 2007
@@ -117,144 +117,43 @@
</ul>
</div>
-<h2><a name="Overview">Overview</a></h2>
-
-<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 and HTTPS on 9002
-respectively. </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>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>ant<br>Buildfile: build.xml
-...
-[jar] Building jar: C:\Java\synapse\samples\axis2Server\repository\services\SimpleStockQuoteService.aar
-BUILD SUCCESSFUL</pre>
-
-<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). 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>
- <li>SecureStockQuoteService1 - Simple stock quote service using WS-Security
- with timestamps and username token authentication</li>
- <li>SecureStockQuoteService3 - Stock quote service using WS-Security
- 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 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
-<number> argument as follows: <br>
-</p>
-<pre>synapse.bat -sample <number> OR synapse.sh -sample <number></pre>
-
-<p>The above command will use the sample_synapse_<number>.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 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><definitions xmlns="http://ws.apache.org/ns/synapse">
-
- <!-- Log all messages passing through -->
- <log level="full"/>
-
- <!-- Send the messages where they have been sent (i.e. implicit "To" EPR) -->
- <send/>
+ <!-- log all attributes of messages passing through -->
+ <log level="full"/>
-</definitions> </pre>
+ <!-- Send the messageto implicit destination -->
+ <send/>
+</definitions>
+ </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
delivered to its ultimate receiver.</strong></p>
-<p>A client could interact with Synapse in one of three modes as follows:</p>
+<p>The Stock quote client can operate in the following modes for this
+example.</p>
<ol>
<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 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>
+ <pre>ant stockquote -Daddurl=http://localhost:9000/soap/SimpleStockQuoteService -Dtrpurl=http://localhost:8080/
+ </pre>
<li>Using Synapse as a HTTP Proxy</li>
-
- <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 be
- able to intercept and mediate the messages and route them as
- appropriate.</p>
+ <pre>ant stockquote -Daddurl=http://localhost:9000/soap/SimpleStockQuoteService -Dprxurl=http://localhost:8080/</pre>
+ <pre></pre>
<li>Dumb Client</li>
- <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>
+ <p>See sample # 1</p>
</ol>
<p><strong>Pre-Requisites:<br>
-</strong>Start the Synapse configuration numbered 0: e.g. synapse.sh -sample
+</strong>Start the Synapse configuration numbered 0: e.g. synapse -sample
0<br>
-Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps
-above)</p>
+Start the Axis2 server and deploy the SimpleStockQuoteService if not already
+deployed</p>
-<p><strong>Execute the Smart Client as 'ant stockquote'<br>
-</strong>Client Code: samples.userguide.StockQuoteClient</p>
+<p><strong>Execute the Smart Client </strong></p>
<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
@@ -263,12 +162,11 @@
<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/soap/SimpleStockQuoteService</p>
+address - which is http://localhost:9000/soap/SimpleStockQuoteService</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>
+invoked generated a stock quote for the requested symbol.</p>
<pre>Sat Nov 18 21:01:23 IST 2006 SimpleStockQuoteService :: Generating quote for : IBM</pre>
<p>The response message generated by the service is again received by
@@ -283,29 +181,24 @@
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>
+run this scenario. However this time the difference is at the client, as it
+sends the message to the WS-Addressing 'To' address
+http://localhost:9000/soap/SimpleStockQuoteService, but the transport
+specifies Synapse as the http proxy. </p>
-<h2><a name="Sample1">Sample 1:</a></h2>
+<h2><a name="Sample1" id="Sample1">Sample 1:</a></h2>
<pre><!-- simple content based routing of messages -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
-
- <!-- simple filtering of messages with XPath and regex matches -->
+ <!-- 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/soap/SimpleStockQuoteService"/>
</endpoint>
</send>
</filter>
-
- <!-- send any other messages without change -->
<send/>
-
-</definitions> </pre>
+</definitions> </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,
@@ -314,21 +207,23 @@
<p><strong>Pre-Requisites:</strong><br>
Start the Synapse configuration numbered 1: i.e. synapse -sample 1<br>
-Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps
-above)<br>
+Start the Axis2 server and deploy the SimpleStockQuoteService if not already
+deployed<br>
</p>
-<p>Execute the Dumb Client as 'ant dumbstockquote'<br>
-Client Code: samples.userguide.DumbStockQuoteClient<br>
-</p>
+<p>Execute the Dumb Client as: </p>
+<pre>ant stockquote -Dtrpurl=http://localhost:8080/soap/StockQuote<br></pre>
<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 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>
+EPR of http://localhost:8080/soap/StockQuote, Synapse performes a match to
+the 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. The 'drop' mediator terminates further processing of the current
+message in a configuration. During response processing, the filter condition
+fails, and thus the implicit 'send' mediator forwards the reply back to the
+client.</p>
<h2><a name="Sample2">Sample 2:</a></h2>
<pre><!-- switch-case mediator and setting and reading of local properties on a message -->
@@ -369,28 +264,30 @@
<p><strong>Pre-Requisites:</strong><br>
Start the Synapse configuration numbered 2: i.e. synapse -sample 2<br>
-Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps
-above)</p>
+Start the Axis2 server and deploy the SimpleStockQuoteService if not already
+done.</p>
-<p>Execute the 'ant stockquote' request again, and by following through the
-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 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/soap/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/soap/SimpleStockQuoteService</pre>
+<p>Execute the 'ant stockquote ..' request again in the smart client mode,
+specifying 'IBM', 'MSFT' and 'SUN' as the stock symbols. When the symbol IBM
+is request, following through the mediation logs 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 using the 'get-property()' XPath
+extension function.</p>
+
+<p>ant stockquote -Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
+-Dtrpurl=http://localhost:8080/ -Dsymbol=IBM</p>
+<pre>INFO LogMediator - symbol = Great stock - IBM, epr = http://localhost:9000/axis2/services/SimpleStockQuoteService </pre>
+
+<p>ant stockquote -Daddurl=http://localhost:9000/soap/SimpleStockQuoteService
+-Dtrpurl=http://localhost:8080/ -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><!-- illustration of local registry entry definitions, and reusable endpoints and sequences -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
-
<!-- define a string resource entry to the local registry -->
<localEntry key="version">0.1</localEntry>
-
<!-- define a reuseable endpoint definition -->
<endpoint name="simple">
<address uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
@@ -398,14 +295,12 @@
<!-- 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"/>
@@ -418,13 +313,10 @@
<sequence key="stockquote"/>
</in>
<out>
- <!-- Send the messages where they have been sent (i.e. implicit To EPR) -->
<send/>
</out>
</sequence>
-
</definitions>
-
</pre>
<p><strong>Objective: Illustrates local registry entry definitions, reusable
@@ -432,21 +324,19 @@
<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>
+Start the Axis2 server and deploy the SimpleStockQuoteService if not already
+done</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 <definitions> tags directly -
-but this is the reccomended and neater approach when the configuration
-becomes non trivial. </p>
+but is the reccomended and neater approach for non trivial configurations.</p>
-<p>Execute the 'ant stockquote' request again, and following through the
+<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 <in> mediator executes, and it
calls into the sequence named "stockquote"</p>
<pre>DEBUG SequenceMediator - Sequence mediator <main> :: mediate()<br>DEBUG InMediator - In mediator mediate()<br>DEBUG SequenceMediator - Sequence mediator <stockquote> :: 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
@@ -457,6 +347,9 @@
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>
+<pre>[HttpServerWorker-1] INFO LogMediator - Text = Sending quote request, version = 0.1, direction = incoming
+[HttpServerWorker-1] DEBUG SendMediator - Send mediator :: mediate()
+[HttpServerWorker-1] DEBUG AddressEndpoint - Sending To: http://localhost:9000/soap/SimpleStockQuoteService </pre>
<h2><a name="Sample41" id="Sample41">Sample 4:</a></h2>
<pre><!-- introduction to error handling -->
@@ -494,7 +387,7 @@
</send>
</case>
<case regex="SUN">
-<sequence key="sunSequence"/>
+ <sequence key="sunSequence"/>
</case>
</switch>
<drop/>
@@ -511,20 +404,15 @@
</send>
</sequence>
-</definitions>
- </pre>
+</definitions> </pre>
<p><strong>Objective: Introduction to error handling with the 'fault'
sequence</strong></p>
<p><strong>Pre-Requisites:</strong><br>
Start the Synapse configuration numbered 4: i.e. synapse -sample 4<br>
-Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps
-above)</p>
-
-<p>When you execute 'ant stockquote', the default stock symbol queried is
-'IBM'. However you could use the 'symbol' system property and pass it into
-the above (e.g. ant stockquote -Dsymbol=MSFT) to query another symbol.</p>
+Start the Axis2 server and deploy the SimpleStockQuoteService if not already
+done</p>
<p>When the IBM stock quote is requested, the configuration routes it to the
endpoint defined as the 'simple' endpoint, which routes the message to the
@@ -532,104 +420,42 @@
message is shown at the client.</p>
<p>If you lookup a stock quote for 'MSFT', Synapse is instructed to route the
-message to the endpoint defined as the 'bogus' endpoint, which tries to
-deliver the message to a non existing service. Hence the method encounters a
-connection exception, which gets handled by the enclosing try mediator. When
-an error is encountered within the scope of a try mediator, it executes the
-mediation logic specified in its 'onError' segment. In this example, the
-sequence named 'errorHandler' is invoked, and it logs the error message as
-well as the error detail, and then creates a custom fault message reading the
-property named 'ERROR_MESSAGE' which is set on the current message by the try
-mediator on encountering an exception. At the client end, you would see the
-custom SOAP fault message instead of a stock quote.</p>
-
-<h2><a name="Sample5">HERE___</a></h2>
-
-<h2><a name="Sample51" id="Sample51">Sample 5:</a></h2>
-<pre><!-- introduction to error handling -->
-<definitions xmlns="http://ws.apache.org/ns/synapse">
-
- <!-- define an endpoint for the stock quote service -->
- <endpoint name="simple">
- <address uri="http://localhost:9000/soap/SimpleStockQuoteService"/>
- </endpoint>
-
- <!-- define a non-existent host to test error handling (runtime exception for invalid host)-->
- <endpoint name="bogusHost">
- <address uri="http://bogus:9000/soap/NonExistentStockQuoteService"/>
- </endpoint>
-
- <!-- define a non-existent port to test error handling (error handling) -->
- <endpoint name="bogusPort">
- <address uri="http://localhost:9009/soap/NonExistentStockQuoteService"/>
- </endpoint>
-
- <!-- the default fault handling sequence used by Synapse - named 'fault' -->
- <sequence name="myFaultHandler">
- <!-- Log the error -->
- <log level="custom">
- <property name="text" value="An unexpected error occured"/>
- <property name="message" expression="get-property('ERROR_MESSAGE')"/>
- <!-- # pick stack trace # <property name="detail" expression="get-property('ERROR_DETAIL')"/>-->
- </log>
-
- <!-- create a custom fault message -->
- <makefault>
- <code value="tns:Receiver" xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/>
- <reason expression="get-property('ERROR_MESSAGE')"/>
- </makefault>
-
- <property name="RESPONSE" value="true"/>
- <header name="To" expression="get-property('ReplyTo')"/>
- <send/>
- </sequence>
-
- <!-- default message handling sequence used by Synapse - named 'main' -->
- <sequence name="main" onError="myFaultHandler">
- <in>
- <switch source="//m0:getQuote/m0:request/m0:symbol"
- xmlns:m0="http://services.samples/xsd">
- <case regex="IBM">
- <send>
- <endpoint key="simple"/>
- </send>
- </case>
- <case regex="MSFT">
- <send>
- <endpoint key="bogusHost"/>
- </send>
- </case>
- <case regex="SUN">
- <send>
- <endpoint key="bogusPort"/>
- </send>
- </case>
- </switch>
- <drop/>
- </in>
-
- <out>
- <send/>
- </out>
- </sequence>
-
-</definitions> </pre>
-
-<p><strong>Objective: Introduction to error handling within a sequence using
-the 'onError' sequence</strong></p>
-
-<p><strong>Pre-Requisites:</strong><br>
-Start the Synapse configuration numbered 5: i.e. synapse -sample 5<br>
-Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps
-above)</p>
-
-<p>This sample demonstrates the ability to assign an existing sequence as the
-error handling sequence of another. The 'onError' attribute of a sequence
-calls on the named sequence specified when an exception is encountered during
-the processing. You could request for IBM and MSFT quotes using the same
-client and experience the same behaviour from Synapse.</p>
+message to the endpoint defined as the 'bogus' endpoint, which does not
+exist. Synapse executes the specified error handler sequence closest to the
+point where the error was encountered. In this case, the currently executing
+sequence is 'main' and it does not specify an 'onError' attribute. Whenever
+Synapse cannot find an error handler, it looks up for a sequence named
+'fault'. Thus the 'fault' sequence can be seen executing, and writing the
+generic error message into the logs. </p>
+<pre>ant stockquote -Daddurl=http://localhost:9000/soap/SimpleStockQuoteService -Dtrpurl=http://localhost:8080/ -Dsymbol=MSFT
+</pre>
+<pre>[HttpServerWorker-1] DEBUG SendMediator - Send mediator :: mediate()
+[HttpServerWorker-1] ERROR IndirectEndpoint - Reference to non-existent endpoint for key : bogus
+[HttpServerWorker-1] DEBUG MediatorFaultHandler - MediatorFaultHandler :: handleFault
+[HttpServerWorker-1] DEBUG SequenceMediator - Sequence mediator <fault> :: mediate()
+[HttpServerWorker-1] DEBUG LogMediator - Log mediator :: mediate()
+[HttpServerWorker-1] INFO LogMediator - text = An unexpected error occured, message = Reference to non-existent endpoint for key : bogus</pre>
+
+<p>When the 'SUN' quote is requested, a custom sequence 'sunSequence' is
+invoked, and it specifies 'sunErrorHandler' as its error handler. Hence when
+the send fails, now you could see the proper error handler invocation and the
+custom error message as follows:</p>
+<pre>
+ant stockquote -Daddurl=http://localhost:9000/soap/SimpleStockQuoteService -Dtrpurl=http://localhost:8080/ -Dsymbol=SUN
+
+[HttpServerWorker-1] DEBUG SequenceMediator - Sequence mediator <sunSequence> :: mediate()
+[HttpServerWorker-1] DEBUG SequenceMediator - Setting the onError handler for the sequence
+[HttpServerWorker-1] DEBUG AbstractListMediator - Implicit Sequence <SequenceMediator> :: mediate()
+[HttpServerWorker-1] DEBUG SendMediator - Send mediator :: mediate()
+[HttpServerWorker-1] ERROR IndirectEndpoint - Reference to non-existent endpoint for key : sunPort
+[HttpServerWorker-1] DEBUG MediatorFaultHandler - MediatorFaultHandler :: handleFault
+[HttpServerWorker-1] DEBUG SequenceMediator - Sequence mediator <sunErrorHandler> :: mediate()
+[HttpServerWorker-1] DEBUG AbstractListMediator - Implicit Sequence <SequenceMediator> :: mediate()
+[HttpServerWorker-1] DEBUG LogMediator - Log mediator :: mediate()
+[HttpServerWorker-1] INFO LogMediator - text = An unexpected error occured for stock SUN, message = Reference to non-existent endpoint for key : sunPort
+</pre>
-<h2><a name="Sample6">Sample 6:</a></h2>
+<h2><a name="Sample6">Sample 5:</a></h2>
<pre><synapse xmlns="http://ws.apache.org/ns/synapse">
<!-- illustration of various mediators : header, in and out mediators -->
@@ -640,7 +466,7 @@
xmlns:m0="http://services.samples/xsd">
<!-- set the message header for the 'To' EPR to the supplied value -->
<header name="To"
- value="http://localhost:9000/soap/SimpleStockQuoteService1"/>
+ value="http://localhost:9000/axis2/services/SimpleStockQuoteService1"/>
<send/>
</filter>
@@ -715,7 +541,7 @@
</set-property>
<endpoint name="stockquote"
- address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
<sequence name="customrequest">
<!-- is this a valid custom request ? -->
@@ -824,7 +650,7 @@
<!-- define a reuseable endpoint definition and use it within config -->
<endpoint name="stockquote"
- address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</definitions>
@@ -1036,7 +862,7 @@
<p>Now edit the repository/conf/sample/resources/endpoint/dynamic_endpt_1.xml
definition and update the address to
-"http://localhost:9000/soap/SimpleStockQuoteService1". After the
+"http://localhost:9000/axis2/services/SimpleStockQuoteService1". After the
cached value expires, the Registry loads the new definition of the endpoint,
and then the messages can be seen being routed to the
SimpleStockQuoteService1.</p>
@@ -1087,7 +913,7 @@
<definitions>
<set-property name="sec_policy" src="file:repository/conf/sample/resources/policy/policy_3.xml"/>
- <endpoint name="secure" address="http://localhost:9000/soap/SecureStockQuoteService3">
+ <endpoint name="secure" address="http://localhost:9000/axis2/services/SecureStockQuoteService3">
<enableSec policy="sec_policy"/>
<enableAddressing/>
</endpoint>
@@ -1095,7 +921,7 @@
<rules>
<in>
- <header name="To" value="http://localhost:9000/soap/SecureStockQuoteService3"/>
+ <header name="To" value="http://localhost:9000/axis2/services/SecureStockQuoteService3"/>
<send>
<endpoint ref="secure"/>
</send>
@@ -1162,7 +988,7 @@
<proxies>
<proxy name="StockQuoteProxy">
- <endpoint address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
<publishWSDL key="proxy_wsdl"/>
</proxy>
</proxies>
@@ -1184,14 +1010,14 @@
above)</p>
<p>Once Synapse starts, you could go to
-http://localhost:8080/soap/StockQuoteProxy?wsdl and view the WSDL
+http://localhost:8080/axis2/services/StockQuoteProxy?wsdl and view the WSDL
for the proxy service defined in the configuration. This WSDL is based on the
source WSDL supplied in the proxy service definition, and is updated to
reflect the proxy service EPR.</p>
<p>Execute the stock quote client by requesting for a stock quote on the
proxy service as follows:</p>
-<pre>ant stockquote -Durl=http://localhost:8080/soap/StockQuoteProxy</pre>
+<pre>ant stockquote -Durl=http://localhost:8080/axis2/services/StockQuoteProxy</pre>
<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
@@ -1200,7 +1026,7 @@
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/soap/StockQuoteProxy?wsdl</p>
+http://localhost:8080/axis2/services/StockQuoteProxy?wsdl</p>
<h2><a name="Sample101">Sample 101:</a></h2>
<pre><synapse xmlns="http://ws.apache.org/ns/synapse">
@@ -1211,11 +1037,11 @@
<sequence name="proxy_1">
<send>
- <endpoint address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</send>
</sequence>
- <endpoint name="proxy_2_endpoint" address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint name="proxy_2_endpoint" address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</definitions>
@@ -1274,7 +1100,7 @@
<header name="wsse:Security" action="remove"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
<send>
- <endpoint address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</send>
</inSequence>
</target>
@@ -1288,7 +1114,7 @@
<header name="wsse:Security" action="remove"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
<send>
- <endpoint address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</send>
</in>
<out>
@@ -1318,7 +1144,7 @@
'url' system properties passed in as follows:</p>
<p>e.g.</p>
-<pre>ant stockquote -Durl=http://localhost:8080/soap/StockQuoteProxy -Dsecpolicy=..\..\repository\conf\sample\resources\policy\policy_1.xml</pre>
+<pre>ant stockquote -Durl=http://localhost:8080/axis2/services/StockQuoteProxy -Dsecpolicy=..\..\repository\conf\sample\resources\policy\policy_1.xml</pre>
<p>The sample security policy policy_1.xml uses timestamps and username token
tuhentication on the stock quote request. Following the debug logs on the
@@ -1327,7 +1153,7 @@
see that the supplied policy file has been attached to the specified WSDL as
well.</p>
-<p>e.g. http://localhost:8080/soap/StockQuoteProxy?wsdl</p>
+<p>e.g. http://localhost:8080/axis2/services/StockQuoteProxy?wsdl</p>
<p>A proxy service with an attached policy - such as a WS-Security policy -
ensures that messages which goes through mediation have satisfied the
@@ -1360,7 +1186,7 @@
<header name="wsse:Security" action="remove"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
<send>
- <endpoint address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</send>
</inSequence>
</target>
@@ -1374,7 +1200,7 @@
<header name="wsse:Security" action="remove"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
<send>
- <endpoint address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</send>
</in>
<out>
@@ -1405,7 +1231,7 @@
and 'gatewayurl' system properties passed in as follows:</p>
<p>e.g.</p>
-<pre>ant dumbstockquote -Dsecpolicy=..\..\repository\conf\sample\resources\policy\client_policy_3.xml -Dgatewayurl=http://localhost:8080/soap/StockQuoteProxy</pre>
+<pre>ant dumbstockquote -Dsecpolicy=..\..\repository\conf\sample\resources\policy\client_policy_3.xml -Dgatewayurl=http://localhost:8080/axis2/services/StockQuoteProxy</pre>
<p>The sample security policy client_policy_3.xml ensures signed and
encrypted messages which request for the stock quotes. Following the debug
@@ -1414,7 +1240,7 @@
you could also see that the supplied policy file has been attached to the
specified WSDL as well.</p>
-<p>e.g. http://localhost:8080/soap/StockQuoteProxy?wsdl</p>
+<p>e.g. http://localhost:8080/axis2/services/StockQuoteProxy?wsdl</p>
<p>By following through the Synapse log messages you could see that the proxy
service received and decrypted the secured SOAP envelope. (If you sent the
@@ -1441,7 +1267,7 @@
<sequence name="proxy_in">
<send>
- <endpoint address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</send>
</sequence>
@@ -1512,21 +1338,21 @@
</m:placeOrder>);
]]></script.js>
<send>
- <endpoint address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</send>
</sequence>
<sequence name="mtom_proxy">
<header name="Action" value="urn:uploadFileUsingMTOM"/>
<send>
- <endpoint address="http://localhost:9000/soap/MTOMSampleService" optimize="mtom"/>
+ <endpoint address="http://localhost:9000/axis2/services/MTOMSampleService" optimize="mtom"/>
</send>
</sequence>
<sequence name="pox_proxy">
<header name="Action" value="urn:placeOrder"/>
<send>
- <endpoint address="http://localhost:9000/soap/SimpleStockQuoteService" force="soap"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService" force="soap"/>
</send>
</sequence>
</definitions>
@@ -1591,7 +1417,7 @@
65.05119159089897 6079 IBM</axis2ns3:text></soapenv:Body></soapenv:Envelope>
..
[JMSWorker-1] DEBUG SendMediator - Sending message to endpoint :: name = null
-resolved address = http://localhost:9000/soap/SimpleStockQuoteService
+resolved address = http://localhost:9000/axis2/services/SimpleStockQuoteService
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header /><soapenv:Body><m:placeOrder xmlns:m="http://services.samples/xsd"><m:order>
<m:price>65.05119159089897</m:price><m:quantity>6079</m:quantity><m:symbol>IBM</m:symbol></m:order></m:placeOrder></soapenv:Body></soapenv:Envelope?</pre>
@@ -1606,7 +1432,7 @@
message to the endpoint as follows, else it encodes the content as Base64:</p>
<p></p>
-<pre>POST /soap/MTOMSampleService HTTP/1.1
+<pre>POST /axis2/services/MTOMSampleService HTTP/1.1
SOAPAction: "urn:uploadFileUsingMTOM"
User-Agent: Axis2Host: 127.0.0.1
Content-Length: 8528
@@ -1642,7 +1468,7 @@
<syn:in>
<syn:header name="Action" value="urn:getQuote"/>
<syn:send>
- <syn:endpoint force="soap" address="http://localhost:9001/soap/SimpleStockQuoteService"/>
+ <syn:endpoint force="soap" address="http://localhost:9001/axis2/services/SimpleStockQuoteService"/>
</syn:send>
</syn:in>
<syn:out>
@@ -1671,7 +1497,7 @@
<rules>
<in>
<send>
- <endpoint address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</send>
</in>
<out>
@@ -1892,7 +1718,7 @@
<set-property name="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/soap/SimpleStockQuoteService"/>
+ <endpoint name="stockquote" address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</definitions>
@@ -1969,7 +1795,7 @@
<definitions>
<!-- define a reuseable endpoint definition and use it within config -->
- <endpoint name="stockquote" address="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint name="stockquote" address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</definitions>
@@ -2057,7 +1883,7 @@
<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="http://localhost:9000/soap/SimpleStockQuoteService"/>
+ <endpoint name="stockquote" address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
</definitions>
Added: webservices/synapse/trunk/java/src/site/resources/new_Synapse_Samples.html
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/src/site/resources/new_Synapse_Samples.html?view=auto&rev=531267
==============================================================================
--- webservices/synapse/trunk/java/src/site/resources/new_Synapse_Samples.html (added)
+++ webservices/synapse/trunk/java/src/site/resources/new_Synapse_Samples.html Sun Apr 22 13:34:41 2007
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+ <title>Apache Synapse Samples</title>
+ <style type="text/css">
+ pre {
+ font-family: Georgia, "Times New Roman",Times, serif;
+ font-size:10;
+ border-style:double;
+ color: darkblue;
+ }
+ </style>
+ <meta name="generator" content="Amaya 9.54, see http://www.w3.org/Amaya/" />
+</head>
+
+<body>
+<p>Overview</p>
+
+<p></p>
+
+<p>Synapse ships with a set of working examples that demonstrates some of the
+basic features and capabilities of Synapse. A set of sample clients and
+services are provided in addition to the sample configurations, and scripts
+are provided to execute the sample scenarions as explained below. </p>
+
+<p>Pre-requisites</p>
+
+<p>You will need a Java development kit / JRE version 1.4 or later and Apache
+Ant 1.5 or later at a minimum to try out the samples. Ant can be downloaded
+from http://ant.apache.org. The JMS examples could be executed against an
+ActiveMQ installation by default (or another JMS provider with configuration)
+and any https examples would require a JDK version 1.5 or later.</p>
+
+<p></p>
+
+<p>Understanding the samples</p>
+
+<p><TODO image></p>
+
+<p>The above diagram depicts the interactions between the clients, Synapse
+and services at a high level. The Clients are able to send SOAP/REST or POX
+messages over transports such as http/s or JMS with WS-Addressing,
+WS-Security or WS-Reliable messaging. They could send binary optimized
+content using MTOM or SwA or binary or plain text JMS messages. After
+mediation through Synapse, the requests are passed over to the sample
+services. The sample clients and services are explained below.</p>
+
+<p>Using the sample clients</p>
+
+<p>The sample clients could be executed from the samples/axis2Client
+directory through the provided ant script. Simply executing 'ant' displays
+the available clients and some of the sample options used to configure them.
+The sample clients available are listed below:</p>
+
+<p>1. Stock quote client</p>
+
+<p>This is a simple SOAP client that could send stock quote requests, and
+receive and display the last sale price for a stock symbol. </p>
+<pre>ant stockquote [-Dsymbol=IBM|MSFT|SUN|..]
+ [-Dmode=quote | customquote | fullquote | placeorder | marketactivity]
+ [-Daddurl=http://localhost:9000/soap/SimpleStockQuoteService]
+ [-Dtrourl=http://localhost:8080] [-Dprxurl=http://localhost:8080]
+ [-Dpolicy=../../repository/conf/sample/resources/policy/policy_1.xml]</pre>
+
+<p>The client is able to operate in the following modes, and send the
+payloads listed below as SOAP messages:</p>
+<ul>
+ <li>quote - send a quote request for a single stock as follows. The
+ response contains the last sales price for the stock which would be
+ displayed
+ <pre><m:GetQuote xmlns:m="http://services.samples/xsd">
+ <m:request>
+ <m:symbol>IBM</m:symbol>
+ </m:request>
+</m:GetQuote></pre>
+ </li>
+ <li>customquote - send a quote request in a custom format. Synapse would
+ transform this custom request into the standard stock quote request
+ format and send it to the service. Upon receipt of the response, it would
+ be transformed again to a custom response format and returned to the
+ client, which will then display the last sales price.
+ <pre><m0:CheckPriceRequest xmlns:m0="http://www.apache-synapse.org/test">
+ <m0:Code>symbol</m0:Code>
+</m0:CheckPriceRequest></pre>
+ </li>
+ <li>fullquote - get quote reports for the stock over a number of days (i.e.
+ last 100 days of the year).
+ <pre><m:GetFullQuote xmlns:m="http://services.samples/xsd">
+ <m:request>
+ <m:symbol>IBM</m:symbol>
+ </m:request>
+</m:GetFullQuote></pre>
+ </li>
+ <li>placeorder - place an order for stocks using a one way request
+ <pre><m:placeOrder xmlns:m="http://services.samples/xsd">
+ <m:order>
+ <m:price>3.141593E0</m:price>
+ <m:quantity>4</m:quantity>
+ <m:symbol>IBM</m:symbol>
+ </m:order>
+</m:placeOrder></pre>
+ </li>
+ <li>marketactivity - get a market activity report for the day (i.e. quotes
+ for multiple symbols)
+ <pre><m:getMarketActivity xmlns:m="http://services.samples/xsd">
+ <m:request>
+ <m:symbol>IBM</m:symbol>
+ ...
+ <m:symbol>MSFT</m:symbol>
+ </m:request>
+</m:getMarketActivity></pre>
+ </li>
+</ul>
+
+<p>Note : See samples/axis2Client/src/samples/common/StockQuoteHandler.java
+for sample responses expected by the clients.</p>
+
+<p>Smart client mode:</p>
+
+<p>The 'addurl' property sets the WS-Addressing EPR, and the 'trpurl' sets a
+transport URL for a message. Thus by specifying both of these properties, the
+client could operate in the 'smart client' mode, where the addressing EPR
+could specify the ultimate receiver, while the transport URL set to Synapse
+would ensure that any necessary mediation takes place before the message is
+delivered to the ultimate reciver. </p>
+<pre>e.g: ant stockquote -Daddurl=<addressingEPR> -Dtrpurl=<synapse></pre>
+
+<p></p>
+
+<p>Dumb client mode:</p>
+
+<p>By specifying only a transport URL, the client operates in the 'dumb
+client' mode, where it sends the message to Synapse and depends on the
+Synapse rules for proper mediation and routing of the message to the ultimate
+destination.</p>
+<pre>e.g: ant stockquote -Dtrpurl=<synapse></pre>
+
+<p></p>
+
+<p>Proxy client mode:</p>
+
+<p>In this mode, the client uses the 'prxurl' as a http proxy to send the
+request. Thus by setting the 'prxurl' to Synapse, the client could ensure
+that the message would reach Synapse for mediation. The client could
+optionally set a WS-Addressing EPR if required.</p>
+<pre>e.g: ant stockquote -Dprxurl=<synapse> [-Daddurl=<addressingEPR>]</pre>
+
+<p>Specifying a policy</p>
+
+<p>By specifying a WS-Policy using the 'policy' property, QoS aspects such as
+WS-Security could be enforced on the request. The policy could specify
+details such as timestamps, signatures and encryption. See Apache Axis2 and
+Apache Rampart documentation for more information.</p>
+
+<p></p>
+
+<p>2. Generic JMS client</p>
+
+<p>The JMS client is able to send plain text, plain binary content or POX
+content by directly publishing a JMS message to the specified destination.
+The JMS destination name should be specified with the 'jms_dest' property.
+The 'jms_type' property could specify 'text', 'binary' or 'pox' to specify
+the type of message payload. </p>
+
+<p>The plain text payload for a 'text' message could be specified through the
+'payload' property. For binary messages, the 'payload' property would contain
+the path to the binary file. For POX messages, the 'payload' property would
+hold a stock symbol name to be used within the POX request for stock order
+placement request.</p>
+
+<p>e.g: </p>
+<pre>ant jmsclient -Djms_type=text -Djms_dest=dynamicQueues/JMSTextProxy -Djms_payload="24.34 100 IBM"
+ant jmsclient -Djms_type=pox -Djms_dest=dynamicQueues/JMSPoxProxy -Djms_payload=MSFT
+ant jmsclient -Djms_type=binary -Djms_dest=dynamicQueues/JMSFileUploadProxy
+ -Djms_payload=./../../repository/conf/sample/resources/mtom/asf-logo.gif</pre>
+
+<p>Note: The JMS client assumes the existence of a default ActiveMQ (4.1.0 or
+above) installation on the local machine.</p>
+
+<p></p>
+
+<p>3. MTOM / SwA client</p>
+
+<p>The MTOM / SwA client is able to send a binary image file as a MTOM or SwA
+optimized message, and receive the same file again through the response and
+save it as a temporary file. The 'opt_mode' could specify 'mtom' or 'swa'
+respectively for the above mentioned optimizations. Optionally the path to a
+custom file could be specified through the 'opt_file' property, and the
+destination address could be changed through the 'opt_url' property if
+required.</p>
+<pre>e.g. ant optimizeclient -Dopt_mode=[mtom | swa]</pre>
+
+<p></p>
+
+<p>Starting the sample services</p>
+
+<p>The sample services ship with a pre-configured Axis2 server and
+demonstrates in-only and in-out SOAP/REST or POX messaging over http/s and
+JMS transports, using WS-Addressing, WS-Security and WS-Reliable Messaging
+and handling of binary content using MTOM and SwA.</p>
+
+<p>The sample services can be found in the samples/axis2Server/src directory
+and could be built and deployed using ant from within each service
+directory</p>
+<pre>asankha@asankha:/tmp/synapse-1.0/samples/axis2Server/src/SimpleStockQuoteService$ ant
+Buildfile: build.xml
+...
+build-service:
+ ....
+ [jar] Building jar: /tmp/synapse-1.0/samples/axis2Server/repository/services/SimpleStockQuoteService.aar
+
+BUILD SUCCESSFUL
+Total time: 3 seconds</pre>
+
+<p>To start the 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 and https on 9002
+respectively. To enable JMS transport, you will need to setup and start a JMS
+provider. An ActiveMQ 4.0.1 or later JMS server on the local machine is
+supported by default, and could be easily enabled by uncommenting the JMS
+transport from the repository/conf/axis2.xml</p>
+
+<p>Sample services</p>
+
+<p>1. SimpleStockQuoteService</p>
+
+<p>This service has four operations, getQuote (in-out), getFullQuote(in-out),
+getMarketActivity(in-out) and placeOrder (in-only). The getQuote operation
+will generate a sample stock quote for a given symbol. The getFullQuote
+operation will generate a history of stock quotes for the symbol for a number
+of days, and the getMarketActivity operation returns stock quotes for a list
+of given symbols. The placeOrder operation will accept a one way message for
+an order.</p>
+
+<p>2. SecureStockQuoteService </p>
+
+<p>This service is a clone of the SimpleStockQuoteService, but has
+WS-Security enabled and an attached security policy for signing and
+encryption of messages.</p>
+
+<p>3. MTOMSwASampleService</p>
+
+<p>This service has three operations uploadFileUsingMTOM(in-out),
+uploadFileUsingSwA(in-out) and oneWayUploadUsingMTOM(in-only) and
+demonstrates the use of MTOM and SwA. The uploadFileUsingMTOM and
+uploadFileUsingSwA operations accept a binary image from the SOAP request as
+MTOM and SwA, and returns this image back again as the response; while the
+oneWayUploadUsingMTOM saves the request message to disk.</p>
+
+<p>Starting sample Synapse configurations</p>
+
+<p>To start Synapse with the sample default configuration, execute the
+synapse.bat or synapse.sh script found in the /bin directory. This starts up
+an instance of Synapse using the Synapse and Axis2 configuration files
+located in the repository/conf directory. The repository/conf/samples
+directory contains the sample configurations available as
+synapse_sample_<n>.xml files. To start a specific sample configuration
+of Synapse, use the '-sample <n>' switch as follows:</p>
+<pre>synapse.bat -sample <n>
+synapse.sh -sample <n></pre>
+
+<p></p>
+
+<p>Table of contents</p>
+
+</body>
+</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org