Author: supun
Date: Thu Feb 3 08:34:40 2011
New Revision: 1066755
URL: http://svn.apache.org/viewvc?rev=1066755&view=rev
Log:
adding documentation for the sample
Modified:
synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml
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=1066755&r1=1066754&r2=1066755&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml (original)
+++ synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml Thu Feb 3 08:34:40
2011
@@ -139,7 +139,11 @@
<li>
<a href="#Sample12">Sample 12: One way messaging / fireAndForget through
Synapse</a></li>
<li>
-<a href="#Sample13">Sample 13: Dual channel invocation through
Synapse</a></li></ul></li>
+<a href="#Sample13">Sample 13: Dual channel invocation through Synapse</a></li>
+<li>
+<a href="#Sample13">Sample 15: Message Enrichment through Synapse</a></li>
+</ul></li>
+
<li>
<a href="#Endpoints">Advanced mediations with endpoints</a>
<ul>
@@ -862,6 +866,7 @@ mediator forwards the response back to t
<pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:9000/services/SimpleStockQuoteService
-Dtrpurl=http://localhost:8280/ -Dmode=placeorder</pre>
<pre xml:space="preserve">SimpleStockQuoteService :: Accepted order for : 7482
stocks of IBM at $ 169.27205579038733</pre>
<p>If you send your client request through TCPmon, you will notice that the
SimpleStockQuoteService replies to Synapse with a HTTP 202 reply, and that
Synapse in turns replies to the client with a HTTP 202 acknowledgment </p>
+
<h2>
<a name="Sample13" id="Sample13">Sample 13: Dual channel invocation through
Synapse</a></h2>
<p>
@@ -876,6 +881,82 @@ mediator forwards the response back to t
Standard dual channel :: Stock price = $57.16686934968289</pre>
<p>If you send your client request through TCPmon, you will notice that
Synapse replies to the client with a HTTP 202 acknowledgment when you send the
request and the communication between Synapse and the server happens on a
single channel and then you get the response back from Synapse to the clients
callback in a different channel (which cannot be observed through TCPmon) </p>
<p>Also you could see the wsa:Reply-To header being something like
http://localhost:8200/axis2/services/anonService2 which implies that the reply
is being on a different channel listening on the port 8200. Please note that it
is required to engage addressing when using the dual channel invocation because
it requires the wsa:Reply-To header. </p>
+
+<h2>
+<a name="Sample10" id="Sample15">Sample 15: Message Enrichment through
Synapse</a></h2>
+<pre xml:space="preserve">
+ <definitions
xmlns="http://synapse.apache.org/ns/2010/04/configuration">
+ <sequence name="main">
+ <in>
+ <enrich>
+ <source type="custom"
+
xpath="//m0:getQuote/m0:request/m0:symbol/text()"
+ xmlns:m0="http://services.samples"/>
+ <target type="property"
property="ORIGINAL_REQ"/>
+ </enrich>
+ <enrich>
+ <source type="body"/>
+ <target type="property"
property="REQUEST_PAYLOAD"/>
+ </enrich>
+
+ <enrich>
+ <source type="inline"
key="init_req"/>
+ <target xmlns:m0="http://services.samples"
+
xpath="//m0:getQuote/m0:request/m0:symbol/text()"/>
+ </enrich>
+
+ <send>
+ <endpoint>
+ <address
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ <drop/>
+ </in>
+ <out>
+ <header xmlns:urn="http://synapse.apache.org"
name="urn:lastTradeTimestamp" value="foo"/>
+ <enrich>
+ <source type="custom"
+
xpath="//ns:getQuoteResponse/ns:return/ax21:lastTradeTimestamp"
+ xmlns:ns="http://services.samples"
+ xmlns:ax21="http://services.samples/xsd"/>
+ <target
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:urn="http://synapse.apache.org"
+
xpath="/soapenv:Envelope/soapenv:Header/urn:lastTradeTimestamp"/>
+ </enrich>
+ <log level="full"/>
+ <log>
+ <property name="Original Request Symbol"
expression="get-property('ORIGINAL_REQ')"/>
+ <property name="Request Payload"
expression="get-property('REQUEST_PAYLOAD')"/>
+ </log>
+ <send/>
+ </out>
+
+ </sequence>
+ <localEntry key="init_req">MSFT</localEntry>
+ <localEntry key="price_req">
+ <m0:symbol
xmlns:m0="http://services.samples">MSFT</m0:symbol>
+ </localEntry>
+
+</definitions>
+</pre>
+<p>
+<strong>Objective: Introduction to Message Copying and Content Enriching with
Enrich Mediator</strong> </p>
+<p>
+<strong>Prerequisites:</strong>
+<br/> Start the Synapse configuration numbered 15: i.e. synapse -sample 15
+<br/> Start the Axis2 server and deploy the SimpleStockQuoteService if not
already done
+</p>
+<pre xml:space="preserve">./axis2server.sh</pre>
+<p>This sample demonstrate the various capabilities of Enrich Mediator. Inside
the in-sequence we store/copy different
+ parts of the message to properties and just before sending the message to
the StockQuoteService, we modify the
+ request value based on the local entry value-init_req. Then in the
out-sequence, the enrich mediator is used
+ to enrich a soap header based on the 'lastTradeTimestamp' value of the
response.
+</p>
+<pre xml:space="preserve">ant stockquote
-Dtrpurl=http://localhost:8280/services/StockQuote</pre>
+<p>You can try with different local entries as the source with the correct
target xpath values. </p>
+
+
+
<h1>
<a name="Endpoints" id="Endpoints">Advanced mediations with endpoints</a> </h1>
<h2>
@@ -914,6 +995,9 @@ Transfer-Encoding: chunked
<m0:symbol>IBM</m0:symbol>
</m0:request>
</m0:getQuote>0</pre>
+
+
+
<h2>
<a name="Sample51" id="Sample51">Sample 51: MTOM and SwA optimizations and
request/response correlation</a></h2>
<pre xml:space="preserve"><definitions
xmlns="http://synapse.apache.org/ns/2010/04/configuraiton">