You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ka...@apache.org on 2011/12/23 12:55:09 UTC

svn commit: r1222651 [8/14] - in /synapse/branches/2.1: ./ modules/distribution/ modules/distribution/src/main/assembly/ modules/documentation/ modules/documentation/src/ modules/documentation/src/site/ modules/documentation/src/site/resources/ modules...

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample258.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample258.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample258.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample258.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 258</title>
+    </properties>
+    <body>
+        <section name="Sample 258: Switching from HTTP to FIX">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;proxy name="FIXProxy" transports="http"&gt;
+        &lt;target&gt;
+            &lt;endpoint&gt;
+                &lt;address
+                        uri="fix://localhost:19876?BeginString=FIX.4.0&amp;SenderCompID=SYNAPSE&amp;TargetCompID=EXEC"/&gt;
+            &lt;/endpoint&gt;
+
+            &lt;inSequence&gt;
+                &lt;property name="transport.fix.ServiceName" value="FIXProxy" scope="axis2-client"/&gt;
+                &lt;log level="full"/&gt;
+            &lt;/inSequence&gt;
+
+            &lt;outSequence&gt;
+                &lt;log level="full"/&gt;
+                &lt;send/&gt;
+            &lt;/outSequence&gt;
+        &lt;/target&gt;
+
+        &lt;parameter name="transport.fix.InitiatorConfigURL"&gt;
+            file:repository/conf/sample/resources/fix/synapse-sender.cfg
+        &lt;/parameter&gt;
+        &lt;parameter name="transport.fix.InitiatorMessageStore"&gt;file&lt;/parameter&gt;
+        &lt;parameter name="transport.fix.SendAllToInSequence"&gt;false&lt;/parameter&gt;
+        &lt;parameter name="transport.fix.DropExtraResponses"&gt;true&lt;/parameter&gt;
+    &lt;/proxy&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrates how to use the FIX transport in a transport switching scenario with
+                    HTTP.
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            You need a <a href="http://www.quickfixj.org">Quickfix/J</a> installation
+                            to try out FIX samples. Please download and extract a Quickfix/J distribution
+                            into your local machine.
+                        </li>
+                        <li>
+                            Configure the Executor sample FIX application (shipped with Quickfix/J)
+                            to receive messages from Synapse and start it (refer
+                            <a href="setup/fix.html#exec">FIX setup guide</a> for more details).
+                        </li>
+                        <li>
+                            Enable the FIX transport sender for Synapse (refer
+                            <a href="setup/fix.html#synapse">FIX setup guide</a> for details).
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 258 (repository/conf/sample/synapse_sample_258.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 258<br/>
+                                Windows: synapse.bat -sample 258
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    Go to the samples/axis2Client directory and invoke the sample FIX/HTTP client as
+                    follows.
+                </p>
+                <div class="command">ant fixclient -Dsymbol=IBM -Dqty=5 -Dmode=buy -Daddurl=http://localhost:8280/services/FIXProxy</div>
+                <p>
+                    This command sends a HTTP request to the FIXProxy on Synapse. The message is
+                    converted into a FIX message and sent to the Executor sample application. Executor
+                    will send two responses for this request (receive ack and the execution report) and
+                    Synapse will send the first response back to the HTTP client. (Synapse can't send
+                    both responses back, since HTTP does not allow sending two responses to the same
+                    request)
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample259.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample259.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample259.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample259.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 259</title>
+    </properties>
+    <body>
+        <section name="Sample 259: Switch from FIX to HTTP">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;localEntry key="xslt-key-req"
+                src="file:repository/conf/sample/resources/transform/transform_fix_to_http.xslt"/&gt;
+
+    &lt;proxy name="FIXProxy" transports="fix"&gt;
+        &lt;target&gt;
+            &lt;endpoint&gt;
+                &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
+            &lt;/endpoint&gt;
+            &lt;inSequence&gt;
+                &lt;log level="full"/&gt;
+                &lt;xslt key="xslt-key-req"/&gt;
+                &lt;log level="full"/&gt;
+            &lt;/inSequence&gt;
+            &lt;outSequence&gt;
+                &lt;log level="full"/&gt;
+            &lt;/outSequence&gt;
+        &lt;/target&gt;
+        &lt;parameter name="transport.fix.AcceptorConfigURL"&gt;
+            file:repository/conf/sample/resources/fix/fix-synapse.cfg
+        &lt;/parameter&gt;
+        &lt;parameter name="transport.fix.AcceptorMessageStore"&gt;file&lt;/parameter&gt;
+    &lt;/proxy&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    In <a href="sample258.html">sample 258</a> we looked at how to forward HTTP
+                    requests over a FIX session. This sample demonstrates how to send a FIX message
+                    to an HTTP endpoint.
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            You need a <a href="http://www.quickfixj.org">Quickfix/J</a> installation
+                            to try out FIX samples. Please download and extract a Quickfix/J distribution
+                            into your local machine.
+                        </li>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Enable the FIX transport receiver for Synapse (refer
+                            <a href="setup/fix.html#synapse">FIX setup guide</a> for details)
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 259 (repository/conf/sample/synapse_sample_259.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 259<br/>
+                                Windows: synapse.bat -sample 259
+                            </div>
+                        </li>
+                        <li>
+                            Configure Banzai sample FIX application (shipped with Quickfix/J) to send
+                            messages to Synapse and start it (refer <a href="setup/fix.html#banzai">FIX setup guide</a>
+                            for more details). If Banzai was properly configured, it should establish
+                            a FIX session with Synapse upon startup. You should see some session logon
+                            messages on Synapse console and Banzai console.
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    This sample expects a Limit order from Banzai to be received by Synapse and
+                    transformed into a place order request in SOAP format. To try it out send a
+                    'Limit' order request from Banzai to Synapse. Synapse will convert it into a
+                    place order request and send to the Axis2 server over HTTP. The stock quote
+                    service in Axis2 will print the following log when it receives the in-only
+                    place order request.
+                </p>
+                <div class="consoleOutput">Accepted order for : 18406 stocks of MSFT at $ 83.58806051152119</div>
+                <p>
+                    Note that the request sent from Banzai must be of type 'Limit'. Otherwise the
+                    XSLT transformation will not work as expected and Axis2 will receive an invalid
+                    request. Also since the place order requests are one-way messages, Banzai is not
+                    supposed to receive any response in this case.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample260.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample260.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample260.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample260.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 260</title>
+    </properties>
+    <body>
+        <section name="Sample 260:Switch from FIX to AMQP">
+    <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+    &lt;proxy name="FIXProxy" transports="fix"&gt;
+        &lt;target&gt;
+            &lt;endpoint&gt;
+                &lt;address
+                        uri="jms:/QpidStockQuoteService?transport.jms.ConnectionFactoryJNDIName=qpidConnectionfactory&amp;java.naming.factory.initial=org.apache.qpid.jndi.PropertiesFileInitialContextFactory&amp;java.naming.provider.url=repository/conf/sample/resources/fix/conn.properties&amp;transport.jms.ReplyDestination=replyQueue"/&gt;
+            &lt;/endpoint&gt;
+            &lt;inSequence&gt;
+                &lt;log level="full"/&gt;
+            &lt;/inSequence&gt;
+            &lt;outSequence&gt;
+                &lt;property name="transport.fix.ServiceName" value="FIXProxy" scope="axis2-client"/&gt;
+                &lt;log level="full"/&gt;
+                &lt;send/&gt;
+            &lt;/outSequence&gt;
+        &lt;/target&gt;
+        &lt;parameter name="transport.fix.AcceptorConfigURL"&gt;
+            file:repository/conf/sample/resources/fix/fix-synapse.cfg
+        &lt;/parameter&gt;
+        &lt;parameter name="transport.fix.AcceptorMessageStore"&gt;
+            file
+        &lt;/parameter&gt;
+    &lt;/proxy&gt;
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+					Demonstrate the capability of switching between FIX and AMQP protocols
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                           You will need the sample FIX blotter that comes with Quickfix/J (Banzai). Configure the blotter to establish sessions with Synapse. (refer
+                            <a href="setup/fix.html#synapse">FIX setup guide</a> for details)
+                        </li>
+                         <li>
+                           Configure the AMQP transport for Synapse. See Configure Synapse for  <a href="setup/jms.html#amqp"> AMQP Transport setup</a> for detail
+                        </li>
+                        <li>
+                           To get an idea about the various transport parameters being used in this sample see FIX Transport Parameters .
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+            	<p>
+            	   Start the AMQP consumer, by switching to samples/axis2Client directory and running the consumer using the following command. Consumer will listen to the queue 'QpidStockQuoteService', accept the orders and reply to the queue 'replyQueue'.
+            	</p>
+                <div class="command">ant amqpconsumer -Dpropfile=$SYNAPSE_HOME/repository/conf/sample/resources/fix/direct.properties</div>
+				<p>
+				  Open up the SYNAPSE_HOME/repository/conf/sample/synapse_sample_260.xml file
+				  and make sure that the transport.fix.AcceptorConfigURL property points
+				  to the fix-synapse.cfg file you created. Once done you can start the
+				  Synapse configuration numbered 260: i.e. synapse -sample 260. Note that
+				  Synapse creates a new FIX session with Banzai at this point.
+				</p>
+				<p>
+				  Send an order request from Banzai to Synapse. e.g. Buy DELL 1000 @ MKT.
+				</p>
+				<p>
+				  Synapse will forward the order request by binding it to a JMS message payload and sending it to the AMQP consumer. AMQP consumer will send a execution back to Banzai.
+				</p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample261.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample261.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample261.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample261.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 261</title>
+    </properties>
+    <body>
+        <section name="Sample 261: Switch Between Different FIX Versions">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;proxy name="OrderProcesserProxy41" transports="fix"&gt;
+        &lt;target&gt;
+            &lt;endpoint&gt;
+                &lt;address
+                        uri="fix://localhost:19877?BeginString=FIX.4.1&amp;SenderCompID=SYNAPSE&amp;TargetCompID=EXEC"/&gt;
+            &lt;/endpoint&gt;
+            &lt;inSequence&gt;
+                &lt;log level="full"/&gt;
+            &lt;/inSequence&gt;
+            &lt;outSequence&gt;
+                &lt;log level="full"/&gt;
+                &lt;send/&gt;
+            &lt;/outSequence&gt;
+        &lt;/target&gt;
+        &lt;parameter name="transport.fix.AcceptorConfigURL"&gt;
+            file:repository/conf/sample/resources/fix/fix-synapse-m40.cfg
+        &lt;/parameter&gt;
+        &lt;parameter name="transport.fix.AcceptorMessageStore"&gt;file&lt;/parameter&gt;
+        &lt;parameter name="transport.fix.InitiatorConfigURL"&gt;
+            file:repository/conf/sample/resources/fix/synapse-sender-m.cfg
+        &lt;/parameter&gt;
+        &lt;parameter name="transport.fix.InitiatorMessageStore"&gt;file&lt;/parameter&gt;
+    &lt;/proxy&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrate the ability of Synapse to switch between FIX versions (eg: FIX 4.0
+                    to FIX 4.1)
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            You need a <a href="http://www.quickfixj.org">Quickfix/J</a> installation
+                            to try out FIX samples. Please download and extract a Quickfix/J distribution
+                            into your local machine.
+                        </li>
+                        <li>
+                            Enable the FIX transport listener and sender for Synapse (refer
+                            <a href="setup/fix.html#synapse">FIX setup guide</a> for details).
+                        </li>
+                        <li>
+                            Configure the Executor sample FIX application (shipped with Quickfix/J)
+                            to receive messages from Synapse and start it (refer <a href="setup/fix.html#exec">FIX setup guide</a>
+                            for more details). In previous samples we only had a FIX 4.0 session configured
+                            for Executor. For this sample we should configure a FIX 4.1 session for
+                            Executor. Therefore before starting it add the following entries to the
+                            configuration file of Executor (executor.cfg).
+                            <div class="consoleOutput">[session]
+BeginString=FIX.4.1
+SocketAcceptPort=19877</div>
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 261 (repository/conf/sample/synapse_sample_261.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 261<br/>
+                                Windows: synapse.bat -sample 261
+                            </div>
+                            If Executor is properly configured, Synapse should establish a FIX 4.1 session
+                            with the Executor upon startup. You should see some log entries confirming
+                            the session logon event on Synapse console as well as Executor console.
+                        </li>
+                        <li>
+                            Configure Banzai sample FIX application (shipped with Quickfix/J) to send
+                            messages to Synapse and start it (refer <a href="setup/fix.html#banzai">FIX setup guide</a>
+                            for more details). You should also add the following entry to the Banzai
+                            configuration file before starting it (replace $SYNAPSE_HOME with the
+                            actual path to Synapse home).
+                            <div class="consoleOutput">DataDictionary=$SYNAPSE_HOME/repository/conf/sample/resources/fix/FIX40-synapse.xml</div>
+                            If Banzai was properly configured, it should establish a FIX 4.0 session with
+                            Synapse upon startup. You should see some session logon messages on Synapse
+                            console and Banzai console.
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    Send some FIX messages from Banzai to Synapse. Synapse will forward all requests
+                    to Executor and get them processes. Responses from Executor will be routed back
+                    to Banzai.
+                </p>
+                <p>
+                    Note that the session between Banzai and Synapse is a FIX 4.0 session whereas
+                    the session between Synapse and Execurot is a FIX 4.1 session. Synapse receives
+                    FIX 4.0 messages and simply forwards them to the FIX 4.1 endpoint.
+                </p>                
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample262.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample262.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample262.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample262.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 262</title>
+    </properties>
+    <body>
+        <section name="Sample 262: Content Based Routing of FIX Messages">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;sequence name="CBR_SEQ"&gt;
+        &lt;in&gt;
+            &lt;switch source="//message/body/field[@id='55']"&gt;
+                &lt;case regex="GOOG"&gt;
+                    &lt;send&gt;
+                        &lt;endpoint&gt;
+                            &lt;address
+                                    uri="fix://localhost:19876?BeginString=FIX.4.0&amp;SenderCompID=SYNAPSE&amp;TargetCompID=EXEC"/&gt;
+                        &lt;/endpoint&gt;
+                    &lt;/send&gt;
+                &lt;/case&gt;
+                &lt;case regex="MSFT"&gt;
+                    &lt;send&gt;
+                        &lt;endpoint&gt;
+                            &lt;address
+                                    uri="fix://localhost:19877?BeginString=FIX.4.1&amp;SenderCompID=SYNAPSE&amp;TargetCompID=EXEC"/&gt;
+                        &lt;/endpoint&gt;
+                    &lt;/send&gt;
+                &lt;/case&gt;
+                &lt;default/&gt;
+            &lt;/switch&gt;
+        &lt;/in&gt;
+        &lt;out&gt;
+            &lt;send/&gt;
+        &lt;/out&gt;
+    &lt;/sequence&gt;
+
+    &lt;proxy name="FIXProxy" transports="fix"&gt;
+        &lt;target inSequence="CBR_SEQ"/&gt;
+        &lt;parameter name="transport.fix.AcceptorConfigURL"&gt;
+            file:repository/conf/sample/resources/fix/fix-synapse.cfg
+        &lt;/parameter&gt;
+        &lt;parameter name="transport.fix.AcceptorMessageStore"&gt;
+            file
+        &lt;/parameter&gt;
+        &lt;parameter name="transport.fix.InitiatorConfigURL"&gt;
+            file:repository/conf/sample/resources/fix/synapse-sender.cfg
+        &lt;/parameter&gt;
+        &lt;parameter name="transport.fix.InitiatorMessageStore"&gt;
+            file
+        &lt;/parameter&gt;
+    &lt;/proxy&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Show case the ability of Synapse to route FIX messages based on the content they
+                    carry.
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            You need a <a href="http://www.quickfixj.org">Quickfix/J</a> installation
+                            to try out FIX samples. Please download and extract a Quickfix/J distribution
+                            into your local machine.
+                        </li>
+                        <li>
+                            Configure the Executor sample FIX application (shipped with Quickfix/J)
+                            to receive messages from Synapse and start it (refer <a href="setup/fix.html#exec">FIX setup guide</a>
+                            for more details). In previous samples we only had a FIX 4.0 session configured
+                            for Executor. For this sample we should also configure a FIX 4.1 session for
+                            Executor. Therefore before starting it add the following entries to the
+                            configuration file of Executor. (Do not remove or change the FIX 4.0
+                            configuration already available in this file)
+                            <div class="consoleOutput">[session]
+BeginString=FIX.4.1
+SocketAcceptPort=19877</div>
+                        </li>
+                        <li>
+                            Enable the FIX transport listener and sender for Synapse (refer
+                            <a href="setup/fix.html#synapse">FIX setup guide</a> for details).
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 262 (repository/conf/sample/synapse_sample_262.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 262<br/>
+                                Windows: synapse.bat -sample 262
+                            </div>
+                            If the Executor was configured properly Synapse should establish 2 sessions
+                            with Executor upon startup (FIX 4.0 session and FIX 4.1 session)
+                        </li>
+                        <li>
+                            Configure Banzai sample FIX application (shipped with Quickfix/J) to send
+                            messages to Synapse and start it (refer <a href="setup/fix.html#banzai">FIX setup guide</a>
+                            for more details). You should also add the following entry to the Banzai
+                            configuration file before starting it (replace $SYNAPSE_HOME with the actual
+                            path to Synapse home).
+                            <div class="consoleOutput">DataDictionary=$SYNAPSE_HOME/repository/conf/sample/resources/fix/FIX40-synapse.xml</div>
+                            If Banzai was properly configured, it should establish a FIX 4.0 session with
+                            Synapse upon startup. You should see some session logon messages on Synapse
+                            console and Banzai console.
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    Send some order requests from Banzai to Synapse containing the synbols 'GOOG' and
+                    'MSFT'. Synapse will forward the messages with the symbol 'GOOG' to the FIX 4.0
+                    session. Messages containing the symbol 'MSFT' will be sent to the FIX 4.1 session.
+                    Any other messages will be simply dropped by the service bus since the default case
+                    of the switch mediator has been kept empty.
+                </p>                
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample263.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample263.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample263.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample263.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!-- ~ 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. -->
+
+<document>
+	<properties>
+		<title>Apache Synapse - Sample 262</title>
+	</properties>
+	<body>
+		<section
+			name="Sample 263: Transport switching - JMS to http/s using JBoss Messaging(JBM)">
+			<div class="xmlConf">
+&lt;definitions xmlns=&quot;http://ws.apache.org/ns/synapse&quot;
+             xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
+             xsi:schemaLocation=&quot;http://ws.apache.org/ns/synapse http://synapse.apache.org/ns/2010/04/configuration/synapse_config.xsd&quot;&gt;
+
+    &lt;proxy name=&quot;StockQuoteProxy&quot; transports=&quot;jms&quot;&gt;
+        &lt;target&gt;
+            &lt;inSequence&gt;
+                &lt;property action=&quot;set&quot; name=&quot;OUT_ONLY&quot; value=&quot;true&quot;/&gt;
+            &lt;/inSequence&gt;
+            &lt;endpoint&gt;
+                &lt;address uri=&quot;http://localhost:9000/services/SimpleStockQuoteService&quot;/&gt;
+            &lt;/endpoint&gt;
+            &lt;outSequence&gt;
+                &lt;send/&gt;
+            &lt;/outSequence&gt;
+        &lt;/target&gt;
+        &lt;publishWSDL uri=&quot;file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl&quot;/&gt;
+        &lt;parameter name=&quot;transport.jms.ContentType&quot;&gt;
+            &lt;rules&gt;
+                &lt;jmsProperty&gt;contentType&lt;/jmsProperty&gt;
+                &lt;default&gt;application/xml&lt;/default&gt;
+            &lt;/rules&gt;
+        &lt;/parameter&gt;
+    &lt;/proxy&gt;
+&lt;/definitions&gt;
+			</div>
+			<subsection name="Objective">
+				<p>
+					Objective: Introduction to switching transports with proxy
+					services.
+					The JMS provider will be								
+					<a class="externalLink" href="http://jboss.org/jbossmessaging/">JBoss Messaging(JBM).</a>
+				</p>
+			</subsection>
+			<subsection name="Pre-requisites">
+				<p>
+					<ul>
+						<li>
+							Start the Axis2 server and deploy the SimpleStockQuoteService
+							(Refer
+							steps above)
+						</li>
+						<li>
+							<a class="externalLink" href="http://jboss.org/jbossmessaging/">Download</a>
+							, install and start JBM server, and configure Synapse to listen
+							on JBM (refer notes below)
+							<br />
+						</li>
+						<li>
+							Start the Synapse configuration numbered 263
+							<div class="command">
+								Unix/Linux: sh synapse.sh -sample 263
+								<br />
+								Windows: synapse.bat -sample 23
+							</div>
+						</li>
+						<li>
+							We need to configure the required queues in JBM. Add the
+							following entry to JBM jms configuration inside
+							file-config/stand-alone/non-clustered/jbm-jms.xml.
+							Once JBM is
+							installed and started you should get a message as
+							follows:
+							<div class="xmlConf">
+&lt;queue name=&quot;StockQuoteProxy&quot;&gt;
+    &lt;entry name=&quot;StockQuoteProxy&quot;/&gt;
+&lt;/queue&gt;
+							</div>
+						</li>
+						<li>
+							Once you started the JBM server with the above changes you'll be
+							able to see the following on STDOUT
+							<div class="consoleOutput">
+10:18:02,673 INFO [org.jboss.messaging.core.server.impl.MessagingServerImpl] JBoss Messaging Server version 2.0.0.BETA3 (maggot, 104) started
+							</div>
+						</li>
+						<li>
+							<p>You will now need to configure the Axis2 instance used by
+								Synapse
+								(not the sample Axis2 server) to enable JMS support using
+								the
+								above provider. Refer Axis2 documentation on setting up JMS
+								in
+								detail (http://ws.apache.org/axis2/1_1/jms-transport.html).
+								You
+								will also need to copy the jbm-core-client.jar,
+								jbm-jms-client.jar, jnp-client.jar(these jars are inside client
+								folder ) and jbm-transports.jar, netty.jar(these jars are from
+								lib folder) jars from JBM into the lib directory to allow
+								Synapse
+								to connect to the JBM JMS provider. This was tested with
+								JBM
+								2.0.0.BETA3
+							</p>
+						</li>
+						<li>
+							<p>You need to add the following configuration for Axis2 JMS transport listener in axis2.xml found at repository/conf/axis2.xml.
+							</p>
+							<div class="consoleOutput">
+&lt;transportReceiver name=&quot;jms&quot; class=&quot;org.apache.axis2.transport.jms.JMSListener&quot;&gt;
+   &lt;parameter name=&quot;java.naming.factory.initial&quot;&gt;org.jnp.interfaces.NamingContextFactory&lt;/parameter&gt;
+   &lt;parameter name=&quot;java.naming.provider.url&quot;&gt;jnp://localhost:1099&lt;/parameter&gt;
+   &lt;parameter name=&quot;java.naming.factory.url.pkgs&quot;&gt;org.jboss.naming:org.jnp.interfaces&lt;/parameter&gt;
+&lt;parameter name=&quot;transport.jms.ConnectionFactoryJNDIName&quot;&gt;ConnectionFactory&lt;/parameter&gt;
+							</div>
+						</li>
+						<li>
+							On the Synapse debug log you will notice that the JMS listener
+							received the request message as:
+							<div class="consoleOutput">
+[JMSWorker-1] DEBUG ProxyServiceMessageReceiver -Proxy Service StockQuoteProxy received a new message...
+							</div>
+						</li>
+						
+						<li>
+							<p>In this sample, the client sends the request message to the
+								proxy service exposed over JMS in Synsape. Synapse forwards this
+								message to the HTTP EPR of the simple stock quote service hosted
+								on the sample Axis2 server. Note that the operation is out-only
+								and no response is sent back to the client. The
+								transport.jms.ContentType property is necessary to allow the JMS
+								transport to determine the content type of incoming messages.
+								With the given configuration it will first try to read the
+								content type from the 'contentType' message property and fall
+								back to 'application/xml' (i.e. POX) if this property is not
+								set.
+								Note that the JMS client used in this example doesn't send any
+								content type information.
+							</p>
+						</li>
+
+					</ul>
+				</p>
+			</subsection>
+			  <subsection name="Executing the Client">
+                <p>
+                    Once you start the Synapse configuration 250 and request for the WSDL of the 
+                    proxy service (http://localhost:8280/services/StockQuoteProxy?wsdl) you will 
+                    notice that its exposed only on the JMS transport. This is because the configuration specified this 
+                    requirement in the proxy service definition.
+                </p>         
+                <div class="command">
+ant jmsclient -Djms_type=pox -Djms_dest=StockQuoteProxy -Djms_payload=MSFT -Djava.naming.provider.url=jnp://localhost:1099 -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -D=java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+				</div>     
+				   
+				   <p>Now if you examine the console running the sample Axis2 server,
+							you will see a message indicating that the server has accepted an
+							order as follows: </p>
+							<div class="consoleOutput">
+Accepted order for : 16517 stocks of MSFT at $169.14622538721846
+							</div> 
+            </subsection>
+
+		</section>
+		<p>
+			<a href="../samples.html">Back to Catalog</a>
+		</p>
+	</body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample264.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample264.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample264.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample264.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 264</title>
+    </properties>
+    <body>
+        <section name="Sample 264: Request-Response Invocations with the JMS Transport">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;proxy name="StockQuoteProxy" transports="http"&gt;
+        &lt;target&gt;
+            &lt;endpoint&gt;
+                &lt;address
+                        uri="jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61616&amp;transport.jms.DestinationType=queue"/&gt;
+            &lt;/endpoint&gt;
+            &lt;inSequence&gt;
+                &lt;property action="set" name="transport.jms.ContentTypeProperty" value="Content-Type"
+                          scope="axis2"/&gt;
+            &lt;/inSequence&gt;
+            &lt;outSequence&gt;
+                &lt;property action="remove" name="TRANSPORT_HEADERS" scope="axis2"/&gt;
+                &lt;send/&gt;
+            &lt;/outSequence&gt;
+        &lt;/target&gt;
+        &lt;publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/&gt;
+    &lt;/proxy&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    In <a href="sample251.html">sample 251</a> we saw how to perform transport switching
+                    between HTTP and JMS using a one-way invocation. Here we will do HTTP to JMS switching
+                    with a two-way, request-response invocation.
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Setup and start a JMS broker (Apache ActiveMQ can be used as the
+                            JMS broker for this scenario. Refer <a href="setup/jms.html#pre">JMS setup guide</a>
+                            for information on how to run ActiveMQ.)
+                        </li>
+                        <li>
+                            Enable the JMS transport receiver of the sample Axis2 server (Refer
+                            <a href="setup/jms.html#server">JMS setup guide</a> for details)
+                        </li>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2 (Since
+                            the JMS receiver is enabled, Axis2 will start polling on a JMS queue)
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 264 (repository/conf/sample/synapse_sample_264.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 264<br/>
+                                Windows: synapse.bat -sample 264
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    Send a stock quote request to Synapse over HTTP using the following command.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dsymbol=MSFT</div>
+                <p>
+                    The proxy service will send the message to the JMS queue named SimpleStockQuoteService
+                    and wait for a response to arrive. In fact the JMS sender in Synapse will create a temporary
+                    queue to start polling on that queue for the response. The address of this queue will
+                    be sent on the request as a JMS header. Axis2 server will consumer the request from the
+                    queue and place a response on the temporary queue created by Synapse. At this point
+                    Synapse will pick up the response and forward it back to the Axis2 client over HTTP.
+                </p>                
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample265.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample265.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample265.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample265.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 265</title>
+    </properties>
+    <body>
+        <section name="Sample 265: Switching from TCP to HTTP/S">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;proxy name="StockQuoteProxy" transports="tcp"&gt;
+        &lt;target&gt;
+            &lt;endpoint&gt;
+                &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
+            &lt;/endpoint&gt;
+            &lt;inSequence&gt;
+                &lt;log level="full"/&gt;
+                &lt;property name="OUT_ONLY" value="true"/&gt;
+            &lt;/inSequence&gt;
+        &lt;/target&gt;
+    &lt;/proxy&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrate the ability of Synapse to receive raw TCP messages and send them to
+                    HTTP endpoints
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Enable the TCP transport receiver for Synapse (refer
+                            <a href="setup/tcp_udp.html#tcp">TCP transport setup guide</a>).
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 265 (repository/conf/sample/synapse_sample_265.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 265<br/>
+                                Windows: synapse.bat -sample 265
+                            </div>
+                        </li>
+                        <li>
+                            Enable the TCP transport sender for the sample Axis2 client (refer
+                            <a href="setup/tcp_udp.html#tcp">TCP transport setup guide</a> for
+                            details).
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    This sample is similar to <a href="sample250.html">Sample 250</a>. Only difference
+                    is instead of the JMS transport we will be using the TCP transport to receive
+                    messages. TCP is not an application layer protocol. Hence there are no application
+                    level headers available in the requests. Synapse has to simply read the XML content
+                    coming through the socket and dispatch it to the right proxy service based on the
+                    information available in the message payload itself. The TCP transport is capable
+                    of dispatching requests based on addressing headers or the first element in the
+                    SOAP body. In this sample, we will get the sample client to send WS-Addressing
+                    headers in the request. Therefore the dispatching will take place based on the
+                    addressing header values.
+                </p>
+                <p>
+                    Invoke the stockquote client using the following command. Note the TCP URL in the
+                    command.
+                </p>
+                <div class="command">ant stockquote -Daddurl=tcp://localhost:6060/services/StockQuoteProxy -Dmode=placeorder</div>
+                <p>
+                    The TCP transport will receive the message and hand it over to the mediation engine.
+                    Synapse will dispatch the request to the StockQuoteProxy service based on the
+                    addressing header values.
+                </p>
+                <p>
+                    When the proxy service forwards the message to the sample Axis2 server over HTTP,
+                    sample server will print the following entry to confirm that the request has
+                    been received.
+                </p>
+                <div class="consoleOutput">Thu May 20 12:25:01 IST 2010 samples.services.SimpleStockQuoteService  :: Accepted order #1 for : 17621 stocks of IBM at $ 73.48068475255796</div>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample266.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample266.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample266.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample266.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 266</title>
+    </properties>
+    <body>
+        <section name="Sample 266: Switching from UDP to HTTP/S">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;proxy name="StockQuoteProxy" transports="udp"&gt;
+        &lt;target&gt;
+            &lt;endpoint&gt;
+                &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
+            &lt;/endpoint&gt;
+            &lt;inSequence&gt;
+                &lt;log level="full"/&gt;
+                &lt;property name="OUT_ONLY" value="true"/&gt;
+            &lt;/inSequence&gt;
+        &lt;/target&gt;
+        &lt;parameter name="transport.udp.port"&gt;9999&lt;/parameter&gt;
+        &lt;parameter name="transport.udp.contentType"&gt;text/xml&lt;/parameter&gt;
+        &lt;publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/&gt;
+    &lt;/proxy&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Showcase the ability of Synapse to receive and process raw UDP messages
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Enable the UDP transport receiver for Synapse (refer
+                            <a href="setup/tcp_udp.html#udp">UDP transport setup guide</a>).
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 266 (repository/conf/sample/synapse_sample_266.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 266<br/>
+                                Windows: synapse.bat -sample 266
+                            </div>
+                        </li>
+                        <li>
+                            Enable the UDP transport sender for the sample Axis2 client (refer
+                            <a href="setup/tcp_udp.html#udp">UDP transport setup guide</a> for
+                            details).
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    This sample is similar to <a href="sample265.html">Sample 265</a>. Only difference
+                    is instead of the TCP transport we will be using the UDP transport to receive
+                    messages.
+                </p>
+                <p>
+                    Invoke the stockquote client using the following command. Note the UDP URL in the
+                    command.
+                </p>
+                <div class="command">ant stockquote -Daddurl=udp://localhost:9999?contentType=text/xml -Dmode=placeorder</div>
+                <p>
+                    Since we have configured the content type as text/xml for the proxy service,
+                    incoming messages will be processed as SOAP 1.1 messages.
+                </p>
+                <p>
+                    When the proxy service forwards the message to the sample Axis2 server over HTTP,
+                    sample server will print the following entry to confirm that the request has
+                    been received.
+                </p>
+                <div class="consoleOutput">Thu May 20 12:25:01 IST 2010 samples.services.SimpleStockQuoteService  :: Accepted order #1 for : 17621 stocks of IBM at $ 73.48068475255796</div>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample3.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample3.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample3.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample3.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 3</title>
+    </properties>
+    <body>
+        <section name="Sample 3: Local Registry Entries, Reusable Endpoints and Sequences">
+            <div class="xmlConf">&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/services/SimpleStockQuoteService"/&gt;
+    &lt;/endpoint&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 --&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;!-- 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;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/&gt;
+        &lt;/out&gt;
+    &lt;/sequence&gt;
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrates how to define local registry entries, sequences and endpoints in a
+                    reusable manner so that they can be used for mediation by referencing them by
+                    names.
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 3 (repository/conf/sample/synapse_sample_3.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 3<br/>
+                                Windows: synapse.bat -sample 3
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    Execute the sample client as follows.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
+                <p>
+                    This example uses a sequence named  'main' that specifies the main mediation
+                    rules to be executed. Following through the mediation logs you will notice
+                    that the sequence named 'main' is executed on receiving the requests (The main 
+                    sequence acts as the default entry point for messages received by Synapse). Then
+                    for the incoming message flow the 'in' mediator executes, and it calls the sequence
+                    named 'stockquote'.
+                </p>
+                <div class="consoleOutput">DEBUG SequenceMediator - Sequence mediator &lt;main&gt; :: mediate()
+DEBUG InMediator - In mediator mediate()
+DEBUG SequenceMediator - Sequence mediator &lt;stockquote&gt; :: mediate()</div>
+                <p>
+                    As the 'stockquote' sequence executes, the log mediator dumps a simple text/string
+                    property, result of an XPath evaluation, that picks up the key named 'version',
+                    and a second result of an XPath evaluation that picks up a local message property
+                    set previously by the property 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 which is visible to all messages that pass through Synapse.
+                </p>
+                <div class="consoleOutput">[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/services/SimpleStockQuoteService </div>
+                <p>
+                    Responses from the Axis2 server will also get dispatched to the main sequence.
+                    But because they are responses the in mediator will not be executed on them.
+                    Only the out mediator will execute on these messages which simply sends them
+                    back to the client using a send mediator.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample300.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample300.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample300.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample300.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 300</title>
+    </properties>
+    <body>
+        <section name="Sample 300: Introduction to Synapse Tasks">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;task class="org.apache.synapse.startup.tasks.MessageInjector" name="CheckPrice"&gt;
+        &lt;property name="to" value="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
+        &lt;property name="soapAction" value="urn:getQuote"/&gt;
+        &lt;property name="message"&gt;
+            &lt;m0:getQuote xmlns:m0="http://services.samples"&gt;
+                &lt;m0:request&gt;
+                    &lt;m0:symbol&gt;IBM&lt;/m0:symbol&gt;
+                &lt;/m0:request&gt;
+            &lt;/m0:getQuote&gt;
+        &lt;/property&gt;
+        &lt;trigger interval="5"/&gt;
+    &lt;/task&gt;
+
+    &lt;sequence name="main"&gt;
+        &lt;in&gt;
+            &lt;send/&gt;
+        &lt;/in&gt;
+        &lt;out&gt;
+            &lt;log level="custom"&gt;
+                &lt;property xmlns:ax21="http://services.samples/xsd"
+                          xmlns:ns="http://services.samples" name="Stock_Quote_on"
+                          expression="//ns:return/ax21:lastTradeTimestamp/child::text()"/&gt;
+                &lt;property xmlns:ax21="http://services.samples/xsd"
+                          xmlns:ns="http://services.samples" name="For_the_organization"
+                          expression="//ns:return/ax21:name/child::text()"/&gt;
+                &lt;property xmlns:ax21="http://services.samples/xsd"
+                          xmlns:ns="http://services.samples" name="Last_Value"
+                          expression="//ns:return/ax21:last/child::text()"/&gt;
+            &lt;/log&gt;
+        &lt;/out&gt;
+    &lt;/sequence&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrate how to schedule tasks in the Synapse runtime for periodic execution
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 300 (repository/conf/sample/synapse_sample_300.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 300<br/>
+                                Windows: synapse.bat -sample 300
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    The above configuration adds a scheduled task to the Synapse runtime. The task
+                    is configured to run every 5 seconds (note the 'interval' attribute on the 'trigger'
+                    element).
+                </p>
+                <p>
+                    One can write his/her own tasks implementing the org.apache.synapse.task.Task
+                    interface and programming the 'execute' method to run the necessary logic. For
+                    this particular sample we have used the MessageInjector class which just injects
+                    a message into Synapse environment. In the configuration we have set the message
+                    payload to be the stock quote request payload.
+                </p>
+                <p>
+                    In this sample, injected messages will be sent to the sample Axis2 server which
+                    will send back a response to Synapse. So every 5 seconds you will notice that Axis2
+                    is generating a quote and Synapse is receiving the stock quote response.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample350.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample350.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample350.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample350.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 350</title>
+    </properties>
+    <body>
+        <section name="Sample 350: Introduction to the Script Mediator using JavaScript">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;registry provider="org.apache.synapse.registry.url.SimpleURLRegistry"&gt;
+        &lt;!-- the root property of the simple URL registry helps resolve a resource URL as root + key --&gt;
+        &lt;parameter name="root"&gt;file:repository/conf/sample/resources/&lt;/parameter&gt;
+        &lt;!-- all resources loaded from the URL registry would be cached for this number of milli seconds --&gt;
+        &lt;parameter name="cachableDuration"&gt;15000&lt;/parameter&gt;
+    &lt;/registry&gt;
+
+    &lt;localEntry key="stockquoteScript"
+                src="file:repository/conf/sample/resources/script/stockquoteTransformRequest.js"/&gt;
+
+    &lt;sequence name="main"&gt;
+        &lt;in&gt;
+            &lt;!-- transform the custom quote request into a standard quote request expected by the service --&gt;
+            &lt;script language="js" key="stockquoteScript" function="transformRequest"/&gt;
+            &lt;send&gt;
+                &lt;endpoint&gt;
+                    &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
+                &lt;/endpoint&gt;
+            &lt;/send&gt;
+        &lt;/in&gt;
+        &lt;out&gt;
+            &lt;!-- transform the standard response back into the custom format the client expects --&gt;
+            &lt;script language="js" key="script/stockquoteTransformResponse.js"
+                    function="transformResponse"/&gt;
+            &lt;send/&gt;
+        &lt;/out&gt;
+    &lt;/sequence&gt;
+
+&lt;/definitions&gt;</div>
+            <p>
+                The JavaScript resource file referenced by the configuration looks like this.
+            </p>
+            <div class="xmlConf">&lt;x&gt;&lt;![CDATA[
+  function transformRequest(mc) {
+     var symbol = mc.getPayloadXML()..*::Code.toString();
+     mc.setPayloadXML(
+        &lt;m:getQuote xmlns:m=&quot;http://services.samples&quot;&gt;
+           &lt;m:request&gt;
+              &lt;m:symbol&gt;{symbol}&lt;/m:symbol&gt;
+           &lt;/m:request&gt;
+        &lt;/m:getQuote&gt;);
+  }
+
+  function transformResponse(mc) {
+     var symbol = mc.getPayloadXML()..*::symbol.toString();
+     var price = mc.getPayloadXML()..*::last.toString();
+     mc.setPayloadXML(
+        &lt;m:CheckPriceResponse xmlns:m=&quot;http://www.apache-synapse.org/test&quot;&gt;
+           &lt;m:Code&gt;{symbol}&lt;/m:Code&gt;
+           &lt;m:Price&gt;{price}&lt;/m:Price&gt;
+        &lt;/m:CheckPriceResponse&gt;);
+  }
+]]&gt;&lt;/x&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Showcase the ability to configure the Synapse runtime using common scripting
+                    languages such as JavaScript
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 350 (repository/conf/sample/synapse_sample_350.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 350<br/>
+                                Windows: synapse.bat -sample 350
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    This sample is similar to <a href="sample8.html">sample 8</a> but instead of using
+                    XSLT, the transformation is done using JavaScript and E4X. Note that the script
+                    source is loaded from a resource in the file system which must be wrapped in
+                    CDATA tags within an XML element. The script used in this example has two functions, 
+                    'transformRequest' and 'transformResponse'. The Synapse configuration uses the
+                    'function' attribute to specify which function should be invoked. Use the stock
+                    quote client to send a custom quote request as follows.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=customquote</div>
+                <p>
+                    Synapse uses the script mediator and the specified JavaScript function to convert
+                    the custom request to a standard quote request. Subsequently the response received
+                    is transformed and sent back to the client.
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample351.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample351.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample351.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample351.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 351</title>
+    </properties>
+    <body>
+        <section name="Sample 351: Inline Scripts with the Script Mediator">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;sequence name="main"&gt;
+        &lt;in&gt;
+            &lt;!-- transform the custom quote request into a standard quote requst expected by the service --&gt;
+            &lt;script language="js"&gt;
+                var symbol = mc.getPayloadXML()..*::Code.toString();
+                mc.setPayloadXML(
+                &lt;m:getQuote xmlns:m="http://services.samples"&gt;
+                    &lt;m:request&gt;
+                        &lt;m:symbol&gt;{symbol}&lt;/m:symbol&gt;
+                    &lt;/m:request&gt;
+                &lt;/m:getQuote&gt;);
+            &lt;/script&gt;
+            &lt;send&gt;
+                &lt;endpoint&gt;
+                    &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
+                &lt;/endpoint&gt;
+            &lt;/send&gt;
+        &lt;/in&gt;
+        &lt;out&gt;
+            &lt;!-- transform the standard response back into the custom format the client expects --&gt;
+            &lt;script language="js"&gt;
+                var symbol = mc.getPayloadXML()..*::symbol.toString();
+                var price = mc.getPayloadXML()..*::last.toString();
+                mc.setPayloadXML(
+                &lt;m:CheckPriceResponse xmlns:m="http://services.samples/xsd"&gt;
+                    &lt;m:Code&gt;{symbol}&lt;/m:Code&gt;
+                    &lt;m:Price&gt;{price}&lt;/m:Price&gt;
+                &lt;/m:CheckPriceResponse&gt;);
+            &lt;/script&gt;
+            &lt;send/&gt;
+        &lt;/out&gt;
+    &lt;/sequence&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    <a href="sample350.html">Sample 350</a> shows how to use scripts stored as
+                    external resources for mediation. This sample demonstrates how small scriplets
+                    can be specified inline with the Synapse configuration thus avoiding the requirement
+                    to have an external registry.
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+                        </li>
+                        <li>
+                            Start Synapse using the configuration numbered 351 (repository/conf/sample/synapse_sample_351.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 351<br/>
+                                Windows: synapse.bat -sample 351
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    The functionality and the behavior of this sample is identical to
+                    <a href="sample350.html">sample 350</a>. Only difference is that, the 2 JS functions
+                    are embedded in the Synapse configuration. To try this out run the following
+                    command on the sample client.
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=customquote</div>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file

Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample352.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample352.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample352.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample352.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  ~  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.
+  -->
+
+<document>
+    <properties>
+        <title>Apache Synapse - Sample 352</title>
+    </properties>
+    <body>
+        <section name="Sample 352: Accessing the Synapse MessageContext API Through Scripts">
+            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;
+
+    &lt;sequence name="main"&gt;
+        &lt;in&gt;
+            &lt;!-- change the MessageContext into a response and set a response payload --&gt;
+            &lt;script language="js"&gt;
+                mc.setTo(mc.getReplyTo());
+                mc.setProperty("RESPONSE", "true");
+                mc.setPayloadXML(
+                &lt;ns:getQuoteResponse xmlns:ns="http://services.samples/xsd"&gt;
+                    &lt;ns:return&gt;
+                        &lt;ns:last&gt;99.9&lt;/ns:last&gt;
+                    &lt;/ns:return&gt;
+                &lt;/ns:getQuoteResponse&gt;);
+            &lt;/script&gt;
+        &lt;/in&gt;
+        &lt;send/&gt;
+    &lt;/sequence&gt;
+
+&lt;/definitions&gt;</div>
+            <subsection name="Objective">
+                <p>
+                    Demonstrate how to access various methods on the Synapse MessageContext API
+                    using the script mediator
+                </p>
+            </subsection>
+            <subsection name="Pre-requisites">
+                <p>
+                    <ul>
+                        <li>
+                            Start Synapse using the configuration numbered 352 (repository/conf/sample/synapse_sample_352.xml)
+                            <div class="command">
+                                Unix/Linux: sh synapse.sh -sample 352<br/>
+                                Windows: synapse.bat -sample 352
+                            </div>
+                        </li>
+                    </ul>
+                </p>
+            </subsection>
+            <subsection name="Executing the Client">
+                <p>
+                    This example shows how an inline JavaScript can access the Synapse message context
+                    API to set its 'To' EPR and to set a custom property to mark it as a response. Execute
+                    the stock quote client, and you will receive the response '99.9' as the last sale
+                    price as per the above script. 
+                </p>
+                <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
+                <p>
+                    Note that the symbol 'mc' is bound to the Synapse MessageContext object by the
+                    script mediator. Then the user can invoke various methods on the message context
+                    using common JavaScript syntax such as mc.getProperty('name') and mc.setTo('epr').
+                </p>
+            </subsection>
+        </section>
+        <p><a href="../samples.html">Back to Catalog</a></p>        
+    </body>
+</document>
\ No newline at end of file