Author: hiranya
Date: Tue Nov 30 00:42:50 2010
New Revision: 1040362
URL: http://svn.apache.org/viewvc?rev=1040362&view=rev
Log:
sample 51
Modified:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples.xml
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample51.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=1040362&r1=1040361&r2=1040362&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
Tue Nov 30 00:42:50 2010
@@ -57,12 +57,12 @@
<subsection name="Endpoints">
<p>
<ul>
- <li><a href="">Sample 50: POX to SOAP
conversion</a></li>
- <li><a href="">Sample 51: MTOM and SwA optimizations
and request/response correlation</a></li>
- <li><a href="">Sample 52: Session less load balancing
between 3 endpoints</a></li>
- <li><a href="">Sample 53: Failover sending among 3
endpoints</a></li>
- <li><a href="">Sample 54: Session affinity load
balancing between 3 endpoints</a></li>
- <li><a href="">Sample 55: Session affinity load
balancing between fail over endpoints</a></li>
+ <li><a href="samples/sample50.html">Sample 50: POX to
SOAP conversion</a></li>
+ <li><a href="samples/sample51.html">Sample 51: MTOM
and SwA optimizations and request/response correlation</a></li>
+ <li><a href="samples/sample52.html">Sample 52: Session
less load balancing between 3 endpoints</a></li>
+ <li><a href="samples/sample53.html">Sample 53:
Failover sending among 3 endpoints</a></li>
+ <li><a href="samples/sample54.html">Sample 54: Session
affinity load balancing between 3 endpoints</a></li>
+ <li><a href="samples/sample55.html">Sample 55: Session
affinity load balancing between fail over endpoints</a></li>
<li><a href="">Sample 56: WSDL endpoint</a></li>
<li><a href="">Sample 57: Dynamic load balancing
between 3 nodes</a></li>
<li><a href="">Sample 58: Static load balancing
between 3 nodes</a></li>
Modified:
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample51.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample51.xml?rev=1040362&r1=1040361&r2=1040362&view=diff
==============================================================================
---
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample51.xml
(original)
+++
synapse/trunk/scratch/hiranya/website/src/site/xdoc/userguide/samples/sample51.xml
Tue Nov 30 00:42:50 2010
@@ -23,7 +23,7 @@
<title>Apache Synapse - Sample 51</title>
</properties>
<body>
- <section name="Sample 51: ">
+ <section name="Sample 51: MTOM and SwA Optimizations and
Request/Response Correlation">
<div class="xmlConf"><definitions
xmlns="http://ws.apache.org/ns/synapse">
<sequence name="main">
@@ -69,14 +69,15 @@
</definitions></div>
<subsection name="Objective">
<p>
-
+ Demonstrate the use of content optimization mechanisms
like MTOM and SwA with
+ Synapse.
</p>
</subsection>
<subsection name="Pre-requisites">
<p>
<ul>
<li>
- Deploy the SimpleStockQuoteService in the sample
Axis2 server and start Axis2
+ Deploy the MTOMSwASampleService in the sample
Axis2 server and start Axis2
</li>
<li>
Start Synapse using the configuration numbered 51
(repository/conf/sample/synapse_sample_51.xml)
@@ -89,11 +90,106 @@
</p>
</subsection>
<subsection name="Executing the Client">
- <div class="command">ant stockquote
-Daddurl=http://localhost:9000/services/SimpleStockQuoteService
-Dtrpurl=http://localhost:8280/</div>
+ <p>
+ Execute the client as follows to send a MTOM optimized
request to Synapse.
+ </p>
+ <div class="command">ant optimizeclient -Dopt_mode=mtom</div>
+ <p>
+ Synapse sets a local message context property, and
forwards the message to
+ 'http://localhost:9000/services/MTOMSwASampleService',
while optimizing binary
+ content as MTOM. By sending this message through TCPMon
you will be able to see
+ the actual message sent by Synapse if required.
+ </p>
+ <div class="consoleOutput">POST /services/MTOMSwASampleService
HTTP/1.1
+Host: 127.0.0.1
+SOAPAction: urn:uploadFileUsingMTOM
+Content-Type: multipart/related;
boundary=MIMEBoundaryurn_uuid_B94996494E1DD5F9B51177413845353;
type="application/xop+xml";
+start="<0.urn:uuid:[email protected]>";
start-info="text/xml"; charset=UTF-8
+Transfer-Encoding: chunked
+Connection: Keep-Alive
+User-Agent: Synapse-HttpComponents-NIO
+
+--MIMEBoundaryurn_uuid_B94996494E1DD5F9B51177413845353241
+Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
+Content-Transfer-Encoding: binary
+Content-ID:
+ <0.urn:uuid:[email protected]>221b1
+ <?xml version='1.0' encoding='UTF-8'?>
+ <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ <soapenv:Body>
+ <m0:uploadFileUsingMTOM
xmlns:m0="http://www.apache-synapse.org/test">
+ <m0:request>
+ <m0:image>
+ <xop:Include
href="cid:1.urn:uuid:[email protected]"
xmlns:xop="http://www.w3.org/2004/08/xop/include" />
+ </m0:image>
+ </m0:request>
+ </m0:uploadFileUsingMTOM>
+ </soapenv:Body>
+ </soapenv:Envelope>
+--MIMEBoundaryurn_uuid_B94996494E1DD5F9B51177413845353217
+Content-Type: image/gif
+Content-Transfer-Encoding: binary
+Content-ID:
+
<1.urn:uuid:[email protected]>22800GIF89a...
<< binary content >></div>
+ <p>
+ During response processing, by checking the local message
property Synapse can
+ discover past information about the current message
context, and use this
+ knowledge to send the response back to the client in the
same format as the
+ original request.
+ </p>
+ <p>
+ When the client executes successfully, it will upload a
file containing the ASF
+ logo and receive a response which is savesd a temporary
file.
+ </p>
+ <div class="consoleOutput">[java] Sending file :
./../../repository/conf/sample/resources/mtom/asf-logo.gif as MTOM
+[java] Saved response to file :
./../../work/temp/sampleClient/mtom-4417.gif</div>
+
+ <p>
+ Now invoke the client as follows to send a SwA optimized
request.
+ </p>
+ <div class="command">ant optimizeclient -Dopt_mode=swa</div>
+ <p>
+ This is identical to the previous invocation with only
difference being the use
+ of SwA (SOAP with Attachement) instead of MTOM for content
optimization. You
+ will get an output similar to following.
+ </p>
+ <div class="consoleOutput">[java] Sending file :
./../../repository/conf/sample/resources/mtom/asf-logo.gif as SwA
+[java] Saved response to file :
./../../work/temp/sampleClient/swa-30391.gif</div>
+ <p>
+ By using TCPMon and sending the message through it, one
can see that the
+ requests and responses sent are indeed sent as HTTP
attachments as follows.
+ </p>
- <div class="consoleOutput">Sat Nov 18 21:01:23 IST 2006
SimpleStockQuoteService :: Generating quote for : IBM</div>
+ <div class="consoleOutput">POST /services/MTOMSwASampleService
HTTP/1.1
+Host: 127.0.0.1
+SOAPAction: urn:uploadFileUsingSwA
+Content-Type: multipart/related;
boundary=MIMEBoundaryurn_uuid_B94996494E1DD5F9B51177414170491;
type="text/xml";
+start="<0.urn:uuid:[email protected]>";
charset=UTF-8
+Transfer-Encoding: chunked
+Connection: Keep-Alive
+User-Agent: Synapse-HttpComponents-NIO
- <div class="consoleOutput">Standard :: Stock price =
$95.26454380258552</div>
+--MIMEBoundaryurn_uuid_B94996494E1DD5F9B51177414170491225
+Content-Type: text/xml; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+Content-ID:
+ <0.urn:uuid:[email protected]>22159
+ <?xml version='1.0' encoding='UTF-8'?>
+ <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ <soapenv:Body>
+ <m0:uploadFileUsingSwA
xmlns:m0="http://www.apache-synapse.org/test">
+ <m0:request>
+
<m0:imageId>urn:uuid:15FD2DA2584A32BF7C1177414169826</m0:imageId>
+ </m0:request>
+ </m0:uploadFileUsingSwA>
+ </soapenv:Body>
+
</soapenv:Envelope>22--34MIMEBoundaryurn_uuid_B94996494E1DD5F9B511774141704912
+17
+Content-Type: image/gif
+Content-Transfer-Encoding: binary
+Content-ID:
+ <urn:uuid:15FD2DA2584A32BF7C1177414169826>22800GIF89a...
<< binary content >></div>
+
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>