Author: hiranya
Date: Thu May 20 09:02:45 2010
New Revision: 946572

URL: http://svn.apache.org/viewvc?rev=946572&view=rev
Log:
Fixing SYNAPSE-654 (Adding a sample for the TCP transport)


Added:
    synapse/trunk/java/repository/conf/sample/synapse_sample_265.xml
Modified:
    synapse/trunk/java/repository/conf/axis2.xml
    synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml
    synapse/trunk/java/src/site/xdoc/Synapse_Samples_Setup.xml

Modified: synapse/trunk/java/repository/conf/axis2.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/axis2.xml?rev=946572&r1=946571&r2=946572&view=diff
==============================================================================
--- synapse/trunk/java/repository/conf/axis2.xml (original)
+++ synapse/trunk/java/repository/conf/axis2.xml Thu May 20 09:02:45 2010
@@ -229,6 +229,11 @@
         <parameter name="non-blocking">true</parameter>
     </transportReceiver>-->
 
+    <!--Uncomment this for TCP transport support
+    <transportReceiver name="tcp" 
class="org.apache.axis2.transport.tcp.TCPServer">
+        <parameter name="port">6060</parameter>
+    </transportReceiver>-->
+
     <!-- ================================================= -->
     <!-- Transport Outs -->
     <!-- ================================================= -->
@@ -302,6 +307,9 @@
            <parameter name="non-blocking">true</parameter>
     </transportSender>-->
 
+    <!--Uncomment this for TCP transport support
+    <transportSender name="tcp" 
class="org.apache.axis2.transport.tcp.TCPTransportSender"/>-->
+
     <!-- ================================================= -->
     <!-- Global Modules  -->
     <!-- ================================================= -->

Added: synapse/trunk/java/repository/conf/sample/synapse_sample_265.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_265.xml?rev=946572&view=auto
==============================================================================
--- synapse/trunk/java/repository/conf/sample/synapse_sample_265.xml (added)
+++ synapse/trunk/java/repository/conf/sample/synapse_sample_265.xml Thu May 20 
09:02:45 2010
@@ -0,0 +1,33 @@
+<!--
+  ~  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.
+  -->
+
+<!-- Switching from TCP to HTTP/S -->
+<definitions xmlns="http://synapse.apache.org/ns/2010/04/configuration";>
+    <proxy name="StockQuoteProxy" transports="tcp">
+        <target>
+            <endpoint>
+                       <address 
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+            </endpoint>
+            <inSequence>
+                <log level="full"/>
+                <property name="OUT_ONLY" value="true"/>
+            </inSequence>
+        </target>
+    </proxy>
+</definitions>
\ No newline at end of file

Modified: synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml?rev=946572&r1=946571&r2=946572&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml (original)
+++ synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml Thu May 20 09:02:45 
2010
@@ -223,6 +223,8 @@
 <a href="#Sample263">Sample 263: Transport switching - JMS to http/s using 
JBoss Messaging(JBM) </a></li>
 <li>
 <a href="#Sample264">Sample 264: Transport switching - HTTP/S to JMS two way 
messages</a></li>
+<li>
+<a href="#Sample266">Sample 265: Switching from TCP to HTTP/S</a></li>
 </ul></li>
 <li>
 <a href="#Task">Introduction to Synapse tasks</a>
@@ -2883,6 +2885,51 @@ it will first try to read the content ty
   <p>In the client side it shoud print a message indicating it has received 
the price.</p>
   <pre xml:space="preserve"> Standard :: Stock price = 
$154.31851804993238</pre>
 
+  <h2>
+    <a name="Sample265" id="Sample265">Sample 265: Switching from TCP to 
HTTP/S</a>
+  </h2>
+  <pre xml:space="preserve">&lt;definitions 
xmlns="http://synapse.apache.org/ns/2010/04/configuration"&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;</pre>
+  <p>
+    <strong>Objective: Demonstrate receiving SOAP messages over TCP and 
forwarding them over HTTP</strong>
+  </p>
+  <p>
+    <strong>Prerequisites:</strong>
+    <br/>You need to configure Synpase to use the TCP transport. The sample 
Axis2 client should also
+      be setup to send TCP requests. Refer <a 
href="Synapse_Samples_Setup.html#tcptransport">Setting
+      Up the TCP Transport</a> section in the sample setup guide for more 
details.
+  </p>
+  <p>
+    This sample is similar to <a href="#Sample250">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>Start Synpase using sample 265.</p>
+  <pre xml:space="preserve">synapse.bat/synapse.sh -sample 265</pre>
+  <p>Start Axis2 server with SimpleStockService deployed</p>
+  <p>Invoke the stockquote client using the following command. Note the TCP 
URL in the command.</p>
+  <pre xml:space="preserve">ant stockquote 
-Daddurl=tcp://localhost:6161/services/StockQuoteProxy -Dmode=placeorder</pre>
+  <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>The sample Axis2 server console will print a message indicating that it 
has received the request: </p>
+  <pre xml:space="preserve">Thu May 20 12:25:01 IST 2010 
samples.services.SimpleStockQuoteService  :: Accepted order #1 for : 17621 
stocks of IBM at $ 73.48068475255796
+</pre>
+
   <h1>
 <a name="Task" id="Task">Introduction to Synapse Tasks</a> </h1>
 <h2>

Modified: synapse/trunk/java/src/site/xdoc/Synapse_Samples_Setup.xml
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/src/site/xdoc/Synapse_Samples_Setup.xml?rev=946572&r1=946571&r2=946572&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/Synapse_Samples_Setup.xml (original)
+++ synapse/trunk/java/src/site/xdoc/Synapse_Samples_Setup.xml Thu May 20 
09:02:45 2010
@@ -715,6 +715,25 @@ synapse.sh -sample &lt;n&gt;</pre>
     refer the <a 
href="http://www.quickfixj.org/quickfixj/usermanual/usage/configuration.html";>Configuring
 Quickfix/J</a> section of the Quickfix/J 
     documentation.
     </p>
+    <h2 id="tcp">
+      Setting up the TCP Transport
+    </h2>
+    <p>
+      To enable the TCP transport for samples first you need to download the 
Axis2 TCP transport
+      jar and copy it to the lib directory of Synapse. Then open up the 
axis2.xml file and uncomment
+      the TCP transport receiver and sender configurations:
+    </p>
+    <pre xml:space="preserve">
+    &lt;transportReceiver name="tcp" 
class="org.apache.axis2.transport.tcp.TCPServer"&gt;
+           &lt;parameter name="port"&gt;6060&lt;/parameter&gt;
+    &lt;/transportReceiver&gt;
+
+    &lt;transportSender name="tcp" 
class="org.apache.axis2.transport.tcp.TCPTransportSender"/&gt;</pre>
+    <p>
+     If you wish to use the sample Axis2 client to send TCP messages, you have 
to uncomment the TCP
+     transport sender configuration in the 
samples/axis2Client/client_repo/conf/axis2.xml file.
+    </p>
+    <p/>
     <h2 id="script">
       Configuring Synapse for Script Mediator Support
     </h2>


Reply via email to