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">&lt;definitions 
xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;sequence name="text_proxy"&gt;
@@ -103,7 +103,8 @@
 &lt;/definitions&gt;</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 '&lt;price&gt; &lt;qty&gt; &lt;symbol&gt;'. 
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=&quot;12.33 1000 ACP&quot; 
-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:
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
+&lt;soapenv:Envelope 
xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
+  &lt;soapenv:Body&gt;
+    &lt;axis2ns1:text 
xmlns:axis2ns1=&quot;http://services.samples/xsd&quot;&gt;12.33 1000 
ACP&lt;/axis2ns1:text&gt;
+  &lt;/soapenv:Body&gt;
+&lt;/soapenv:Envelope&gt;</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:
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
+&lt;soapenv:Envelope 
xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
+  &lt;soapenv:Body&gt;
+    &lt;placeOrder xmlns=&quot;http://services.samples&quot;&gt;
+      &lt;order xmlns=&quot;http://services.samples/xsd&quot;&gt;
+        &lt;price&gt;12.33&lt;/price&gt;
+        &lt;quantity&gt;1000&lt;/quantity&gt;
+        &lt;symbol&gt;ACP&lt;/symbol&gt;
+      &lt;/order&gt;
+    &lt;/placeOrder&gt;
+  &lt;/soapenv:Body&gt;
+&lt;/soapenv:Envelope&gt;</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:
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
+&lt;soapenv:Envelope 
xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
+  &lt;soapenv:Body&gt;
+    &lt;axis2ns1:element 
xmlns:axis2ns1=&quot;http://services.samples/xsd&quot;&gt;R0lGODlhgw...AAOw==&lt;/axis2ns1:element&gt;
+  &lt;/soapenv:Body&gt;
+&lt;/soapenv:Envelope&gt;</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">&lt;definitions 
xmlns="http://ws.apache.org/ns/synapse"&gt;
 
     &lt;proxy name="JMStoHTTPStockQuoteProxy" transports="jms"&gt;
@@ -59,7 +59,9 @@
 &lt;/definitions&gt;</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=&quot;jms:/JMStoHTTPStockQuoteProxy?\
+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.ContentTypeProperty=Content-Type&amp;transport.jms.DestinationType=queue&quot;</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: &quot;urn:placeOrder&quot;
+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>        


Reply via email to