Author: heshan
Date: Wed Mar 9 10:15:49 2011
New Revision: 1079727
URL: http://svn.apache.org/viewvc?rev=1079727&view=rev
Log:
Documentation patch for SYNAPSE-732
Thanks Kasun Indrasiri for the contribution.
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=1079727&r1=1079726&r2=1079727&view=diff
==============================================================================
--- synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml (original)
+++ synapse/trunk/java/src/site/xdoc/Synapse_Samples.xml Wed Mar 9 10:15:49
2011
@@ -188,7 +188,10 @@
<li>
<a href="#Sample154">Sample 154: Load Balancing with Proxy Service </a></li>
<li>
-<a href="#Sample155">Sample 155: Dual channel invocation on both client side
and server side of Synapse with Proxy Services</a></li></ul></li>
+<a href="#Sample155">Sample 155: Dual channel invocation on both client side
and server side of Synapse with Proxy Services</a></li>
+<li>
+<a href="#Sample156">Sample 156: Service Integration with specifying the
receiving sequence</a></li>
+</ul></li>
<li>
<a href="#ProxyServiceQoS">QoS addition and deduction for service mediation
(proxy) samples</a>
<ul>
@@ -2087,6 +2090,7 @@ Connection: Keep-Alive
<p>Run the client with </p>
<pre xml:space="preserve"> ant loadbalancefailover -Dmode=session
-Dtrpurl=http://localhost:8280/services/LBProxy </pre>
<p>Functionality is similar to the sample #54. </p></div>
+
<h2>
<a name="Sample155" id="Sample155">Sample 155: Dual channel invocation on both
client side and serverside of Synapse with Proxy Services</a></h2>
<pre xml:space="preserve"><definitions
xmlns="http://ws.apache.org/ns/synapse">
@@ -2116,6 +2120,105 @@ Connection: Keep-Alive
<pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=dualquote</pre>
<p>In the above example, the request received is forwarded to the sample
service hosted on Axis2 and the endpoint specifies to enable addressing and do
the invocation over a dual channel. If you observe this message flow by using a
TCPmon, you could see that on the channel you send the request to Synapse the
response has been written as an HTTP 202 Accepted, where as the real response
from Synapse will come over a different channel which cannot be obsesrved
unless you use tcpdump to dump all the TCP level messages. </p>
<p>At the same time you can observe the behaviour of the invocation between
Synapse and the actual Axis2 service, where you can see a 202 Accepted message
being delivered to Synapse as the response to the request. The actual response
will be delivered to Synapse over a different channel. </p>
+
+<h2>
+<a name="Sample156" id="Sample156">Sample 156: Service Integration with
specifying the receiving sequence</a></h2>
+<pre xml:space="preserve">
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+ <localEntry key="sec_policy"
src="file:repository/conf/sample/resources/policy/policy_3.xml"/>
+ <proxy name="StockQuoteProxy">
+ <target>
+ <inSequence>
+ <enrich>
+ <source type="body"/>
+ <target type="property"
property="REQUEST"/>
+ </enrich>
+
+ <send receive="SimpleServiceSeq">
+ <endpoint name="secure">
+ <address
uri="http://localhost:9000/services/SecureStockQuoteService">
+ <enableSec policy="sec_policy"/>
+ </address>
+ </endpoint>
+ </send>
+ </inSequence>
+ <outSequence>
+ <drop/>
+ </outSequence>
+ </target>
+ </proxy>
+
+
+ <sequence name="SimpleServiceSeq">
+ <property name="SECURE_SER_AMT"
expression="//ns:getQuoteResponse/ns:return/ax21:last"
+ xmlns:ns="http://services.samples"
xmlns:ax21="http://services.samples/xsd"/>
+ <log level="custom">
+ <property name="SecureStockQuoteService-Amount"
expression="get-property('SECURE_SER_AMT')"/>
+ </log>
+ <enrich>
+ <source type="body"/>
+ <target type="property"
property="SecureService_Res"/>
+ </enrich>
+ <enrich>
+ <source type="property"
property="REQUEST"/>
+ <target type="body"/>
+ </enrich>
+ <send receive="ClientOutSeq">
+ <endpoint name="SimpleStockQuoteService">
+ <address
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </sequence>
+
+ <sequence name="ClientOutSeq">
+ <property name="SIMPLE_SER_AMT"
expression="//ns:getQuoteResponse/ns:return/ax21:last"
+ xmlns:ns="http://services.samples"
xmlns:ax21="http://services.samples/xsd"/>
+ <log level="custom">
+ <property name="SimpleStockQuoteService-Amount"
expression="get-property('SIMPLE_SER_AMT')"/>
+ </log>
+ <enrich>
+ <source type="body"/>
+ <target type="property"
property="SimpleService_Res"/>
+ </enrich>
+
+ <filter
xpath="fn:number(get-property('SIMPLE_SER_AMT')) >
fn:number(get-property('SECURE_SER_AMT'))">
+ <then>
+ <log>
+ <property name="StockQuote"
value="SecureStockQuoteService"/>
+ </log>
+ <enrich>
+ <source type="property"
property="SecureService_Res"/>
+ <target type="body"/>
+ </enrich>
+ </then>
+ <else>
+ <log>
+ <property name="StockQuote"
value="SimpleStockQuoteService"/>
+ </log>
+ </else>
+ </filter>
+ <send/>
+ </sequence>
+</definitions></pre>
+
+<p>
+<strong>Objective: Using synapse to integrate services.</strong> </p>
+<p>
+<p>
+<strong>Prerequisites:</strong>
+<br/> We will be using two services in this sample; i.e.
SimpleStockQuoteService and SecureStockQuoteService. Therefore the
prerequisites of sample 100 is also applied here.</p>
+<p>Start the Synapse configuration numbered 156: i.e. synapse -sample 156
+<br/> Start the Axis2 server and deploy the SimpleStockQuoteService and the
SecureStockQuoteService, if not already done </p>
+
+<p>This sample contains a proxy service which provides the seamless
integration of SimpleStockQuoteService and SecureStockQuoteService. Once a
client send a request to this
+proxy service, it sends the same request to both these services and resolve
the service with cheapest stock quote price.</p>
+<p>Execute the stock quote client by requesting for a cheapest stock quote
from the proxy service as follows: </p>
+<pre xml:space="preserve">ant stockquote
-Daddurl=http://localhost:8280/services/StockQuoteProxy</pre>
+<p>Above sample uses the concept of specifying the receiving sequence in the
send mediator. In this case once the message is sent from the in sequence then
the response won't come to
+out sequence as the receiving sequence is specified in the send mediator.</p>
+
+
+
<h1>
<a name="ProxyServiceQoS" id="ProxyServiceQoS">QoS addition and deduction for
service mediation (proxy) samples</a> </h1>
<h2>