You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by hi...@apache.org on 2010/12/13 23:23:26 UTC
svn commit: r1045393 - in
/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide: samples.xml
samples/sample252.xml samples/sample253.xml
Author: hiranya
Date: Mon Dec 13 22:23:26 2010
New Revision: 1045393
URL: http://svn.apache.org/viewvc?rev=1045393&view=rev
Log:
samples 252, 253
Modified:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample252.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample253.xml
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml?rev=1045393&r1=1045392&r2=1045393&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml Mon Dec 13 22:23:26 2010
@@ -102,8 +102,8 @@
<ul>
<li><a href="samples/sample250.html">Sample 250: Introduction to transport switching - JMS to HTTP/S</a></li>
<li><a href="samples/sample251.html">Sample 251: Switching from http/s to JMS</a></li>
- <li><a href="">Sample 252: Pure text/binary and POX message support with JMS</a></li>
- <li><a href="">Sample 253: One way bridging from JMS to http and replying with a 202 Accepted response</a></li>
+ <li><a href="samples/sample252.html">Sample 252: Pure text, binary and POX message support with JMS</a></li>
+ <li><a href="samples/sample253.html">Sample 253: One way bridging from JMS to http and replying with a 202 Accepted response</a></li>
<li><a href="">Sample 254: Using the file system as transport medium using VFS transport listener and sender</a></li>
<li><a href="">Sample 255: Switching from ftp transport listener to mail transport sender</a></li>
<li><a href="">Sample 256: Proxy services with the mail transport</a></li>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample252.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample252.xml?rev=1045393&r1=1045392&r2=1045393&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample252.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample252.xml Mon Dec 13 22:23:26 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 252</title>
</properties>
<body>
- <section name="Sample 252: ">
+ <section name="Sample 252: Pure Text, Binary and POX Message Support with JMS">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<sequence name="text_proxy">
@@ -103,7 +103,8 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate the ability of Synapse to receive and mediate plain text, binary and
+ POX (Plain Old XML) messages over JMS.
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -113,6 +114,15 @@
Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
</li>
<li>
+ Setup and start a JMS broker (Apache ActiveMQ can be used as the
+ JMS broker for this scenario. Refer JMS setup guide for information on
+ how to run ActiveMQ.)
+ </li>
+ <li>
+ Enable the JMS transport receiver of Synapse (Refer JMS setup guide for
+ more details)
+ </li>
+ <li>
Start Synapse using the configuration numbered 252 (repository/conf/sample/synapse_sample_252.xml)
<div class="command">
Unix/Linux: sh synapse.sh -sample 252<br/>
@@ -123,11 +133,109 @@
</p>
</subsection>
<subsection name="Executing the Client">
- <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
-
- <div class="consoleOutput">Sat Nov 18 21:01:23 IST 2006 SimpleStockQuoteService :: Generating quote for : IBM</div>
-
- <div class="consoleOutput">Standard :: Stock price = $95.26454380258552</div>
+ <p>
+ This configuration creates 3 JMS proxy services named JMSFileUploadProxy,
+ JMSTextProxy and JMSPoxProxy exposed over JMS queues with the same names as the
+ services. The first part of this example demonstrates the pure text message
+ support with JMS, where a user sends a space separated text message over JMS of
+ the form '<price> <qty> <symbol>'. Synapse converts this message
+ into a SOAP message and sends this to the placeOrder operation of the SimpleStockQuoteService.
+ Synapse uses the script mediator to transform the text message into a XML payload
+ using the JavaScript support available to tokenize the string. The proxy service
+ property named 'Wrapper' defines a custom wrapper element QName, to be used when
+ wrapping text/binary content into a SOAP envelope.
+ </p>
+ <p>
+ Execute JMS client as follows. This will post a pure text JMS message with the
+ content defined (e.g. '12.33 1000 ACP') to the specified JMS destination -
+ dynamicQueues/JMSTextProxy.
+ </p>
+ <div class="command">ant jmsclient -Djms_type=text -Djms_payload="12.33 1000 ACP" -Djms_dest=dynamicQueues/JMSTextProxy</div>
+ <p>
+ Following the logs, you will notice that Synapse received the JMS text message
+ and transformed it into a SOAP payload as follows. Notice that the wrapper element
+ '{http://services.samples/xsd}text' has been used to wrap the text message
+ content.
+ </p>
+ <div class="consoleOutput">[jms-Worker-1] INFO LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: ID:orcus.veithen.net-50631-1225235276233-1:0:1:1:1, Direction: request,
+Envelope:
+<?xml version="1.0" encoding="utf-8"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ <soapenv:Body>
+ <axis2ns1:text xmlns:axis2ns1="http://services.samples/xsd">12.33 1000 ACP</axis2ns1:text>
+ </soapenv:Body>
+</soapenv:Envelope></div>
+ <p>
+ Then you can see how the script mediator creates a stock quote request by tokenizing
+ the text as follows.
+ </p>
+ <div class="consoleOutput">[jms-Worker-1] INFO LogMediator To: , WSAction: urn:placeOrder, SOAPAction: urn:placeOrder, MessageID: ID:orcus.veithen.net-50631-1225235276233-1:0:1:1:1, Direction: request,
+Envelope:
+<?xml version="1.0" encoding="utf-8"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ <soapenv:Body>
+ <placeOrder xmlns="http://services.samples">
+ <order xmlns="http://services.samples/xsd">
+ <price>12.33</price>
+ <quantity>1000</quantity>
+ <symbol>ACP</symbol>
+ </order>
+ </placeOrder>
+ </soapenv:Body>
+</soapenv:Envelope></div>
+ <p>
+ This SOAP message is then sent to the SimpleStockQuoteService on the sample
+ Axis2 server. The sample Axis2 server will accept the one-way message and print
+ the following log:
+ </p>
+ <div class="consoleOutput">samples.services.SimpleStockQuoteService :: Accepted order for : 1000 stocks of ACP at $ 12.33</div>
+ <p>
+ The next section of this example demonstrates how a pure binary JMS message can
+ be received and processed through Synapse. The configuration creates a proxy
+ service named 'JMSFileUploadProxy' that accepts binary messages and wraps them
+ into a custom element '{http://services.samples/xsd}element'. The received
+ message is then forwarded to the MTOMSwASampleService using the SOAP action
+ 'urn:oneWayUploadUsingMTOM' while optimizing binary content using MTOM. To execute
+ this sample, use the JMS client to publish a pure binary JMS message containing
+ the file './../../repository/conf/sample/resources/mtom/asf-logo.gif' to the JMS
+ destination 'dynamicQueues/JMSFileUploadProxy' as follows:
+ </p>
+ <div class="command">ant jmsclient -Djms_type=binary -Djms_dest=dynamicQueues/JMSFileUploadProxy \
+ -Djms_payload=./../../repository/conf/sample/resources/mtom/asf-logo.gif</div>
+ <p>
+ Examining the Synapse logs will reveal that the binary content was received
+ over JMS and wrapped with the specified element into a SOAP infoset as follows:
+ </p>
+ <div class="consoleOutput">[jms-Worker-1] INFO LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: ID:orcus.veithen.net-50702-1225236039556-1:0:1:1:1, Direction: request,
+Envelope:
+<?xml version="1.0" encoding="utf-8"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ <soapenv:Body>
+ <axis2ns1:element xmlns:axis2ns1="http://services.samples/xsd">R0lGODlhgw...AAOw==</axis2ns1:element>
+ </soapenv:Body>
+</soapenv:Envelope></div>
+ <p>
+ Thereafter the message is sent as a MTOM optimized message as specified by the
+ 'format=mtom' attribute of the endpoint, to the MTOMSwASampleService using the
+ SOAP action 'urn:oneWayUploadUsingMTOM'. Once received by the sample service,
+ it is saved into a temporary file and could be verified for correctness.
+ </p>
+ <div class="consoleOutput">Wrote to file : ./../../work/temp/sampleServer/mtom-4417.gif</div>
+ <p>
+ The final section of this example shows how a POX JMS message is received by Synapse
+ and sent to the SimpleStockQuoteService as a SOAP message. Use the JMS client as
+ follows to create a POX (Plain Old XML) message with a stock quote request payload
+ (without a SOAP envelope), and send it to the JMS destination 'dynamicQueues/JMSPoxProxy'
+ as follows:
+ </p>
+ <div class="command">ant jmsclient -Djms_type=pox -Djms_dest=dynamicQueues/JMSPoxProxy -Djms_payload=MSFT</div>
+ <p>
+ Synapse converts the POX message into a SOAP payload and sends to the
+ SimpleStockQuoteService after setting the SOAP action as 'urn:placeOrder'.
+ The sample Axis2 server displays a successful message on the receipt of the
+ message as:
+ </p>
+ <div class="consoleOutput">samples.services.SimpleStockQuoteService :: Accepted order for : 19211 stocks of MSFT at $ 172.39703010684752</div>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
Modified: synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample253.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample253.xml?rev=1045393&r1=1045392&r2=1045393&view=diff
==============================================================================
--- synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample253.xml (original)
+++ synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample253.xml Mon Dec 13 22:23:26 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 253</title>
</properties>
<body>
- <section name="Sample 253: ">
+ <section name="Sample 253: One-way Bridging from JMS to HTTP and Replying with a 202 Accepted Response">
<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
<proxy name="JMStoHTTPStockQuoteProxy" transports="jms">
@@ -59,7 +59,9 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ This sample demonstrates the ability of Synapse to perform transport switching
+ between JMS and HTTP. It also shows how to configure a one-way HTTP proxy in
+ Synapse.
</p>
</subsection>
<subsection name="Pre-requisites">
@@ -69,6 +71,15 @@
Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
</li>
<li>
+ Setup and start a JMS broker (Apache ActiveMQ can be used as the
+ JMS broker for this scenario. Refer JMS setup guide for information on
+ how to run ActiveMQ.)
+ </li>
+ <li>
+ Enable the JMS transport receiver of Synapse (Refer JMS setup guide for
+ more details)
+ </li>
+ <li>
Start Synapse using the configuration numbered 253 (repository/conf/sample/synapse_sample_253.xml)
<div class="command">
Unix/Linux: sh synapse.sh -sample 253<br/>
@@ -79,11 +90,38 @@
</p>
</subsection>
<subsection name="Executing the Client">
- <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
-
- <div class="consoleOutput">Sat Nov 18 21:01:23 IST 2006 SimpleStockQuoteService :: Generating quote for : IBM</div>
+ <p>
+ This example invokes the one-way 'placeOrder' operation on the SimpleStockQuoteService
+ using the Axis2 ServiceClient.fireAndForget() API at the client. To test this,
+ run the sample client as follows and you will notice the one-way JMS message
+ flowing through Synapse into the sample Axis2 server instance over HTTP, and Axis2
+ acknowledging it with a HTTP 202 Accepted response.
+ </p>
+ <div class="command">ant stockquote -Dmode=placeorder -Dtrpurl="jms:/JMStoHTTPStockQuoteProxy?\
+transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory\
+&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory\
+&java.naming.provider.url=tcp://localhost:61616\
+&transport.jms.ContentTypeProperty=Content-Type&transport.jms.DestinationType=queue"</div>
+ <p>
+ The second example shows how Synapse could be made to respond with a HTTP 202
+ Accepted response to a request received. The proxy service simply logs the message
+ received and acknowledges it. To try this out, run the sample client as follows.
+ </p>
+ <div class="command">ant stockquote -Dmode=placeorder -Dtrpurl=http://localhost:8280/services/OneWayProxy</div>
+ <p>
+ On the Synapse console you could see the logged message, and if TCPMon was used
+ at the client, you would see the 202 Accepted response sent back to the client
+ from Synapse.
+ </p>
+ <div class="consoleOutput">HTTP/1.1 202 Accepted
+Content-Type: text/xml; charset=UTF-8
+Host: 127.0.0.1
+SOAPAction: "urn:placeOrder"
+Date: Sun, 06 May 2007 17:20:19 GMT
+Server: Synapse-HttpComponents-NIO
+Transfer-Encoding: chunked
- <div class="consoleOutput">Standard :: Stock price = $95.26454380258552</div>
+0</div>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>