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 2011/12/22 17:16:05 UTC
svn commit: r1222320 [6/13] - in /synapse/branches/2.1/src: ./ site/
site/resources/ site/resources/css/ site/resources/images/ site/xdoc/
site/xdoc/userguide/ site/xdoc/userguide/samples/
site/xdoc/userguide/samples/setup/
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample152.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample152.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample152.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample152.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 152</title>
+ </properties>
+ <body>
+ <section name="Sample 152: Switching Transports and Message Format from SOAP to REST/POX">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <proxy name="StockQuoteProxy" transports="https">
+ <target>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="pox"/>
+ </endpoint>
+ <outSequence>
+ <send/>
+ </outSequence>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+ </proxy>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate implementing simple transport switching and message format switching
+ scenarios using proxy services
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 152 (repository/conf/sample/synapse_sample_152.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 152<br/>
+ Windows: synapse.bat -sample 152
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ This configuration demonstrates how a proxy service can be exposed on a subset
+ of available transports, and how it could switch from one transport to another.
+ This example exposes the created proxy service only on HTTPS, and thus if the
+ user tries to access it over HTTP, it would result in a fault.
+ </p>
+ <div class="consoleOutput">ant stockquote -Dtrpurl=http://localhost:8280/services/StockQuoteProxy
+...
+ [java] org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) /soap/StockQuoteProxy</div>
+
+ <p>
+ Accessing this over HTTPS causes the proxy service to access the SimpleStockQuoteService
+ on the sample Axis2 server using REST/POX.
+ </p>
+ <div class="command">ant stockquote -Dtrpurl=https://localhost:8243/services/StockQuoteProxy</div>
+
+ <p>
+ TCPMon can be used to trace the actual REST/POX messages exchanged between Synapse
+ and the sample Axis2 server. Synapse converts the POX response back to SOAP before
+ sending it back to the client.
+ </p>
+ <div class="consoleOutput">POST /services/SimpleStockQuoteService HTTP/1.1
+Host: 127.0.0.1
+SOAPAction: urn:getQuote
+Content-Type: application/xml; charset=UTF-8;action="urn:getQuote";
+Transfer-Encoding: chunked
+Connection: Keep-Alive
+User-Agent: Synapse-HttpComponents-NIO
+
+75
+<m0:getQuote xmlns:m0="http://services.samples">
+ <m0:request>
+ <m0:symbol>IBM</m0:symbol>
+ </m0:request>
+</m0:getQuote></div>
+
+ <div class="consoleOutput">HTTP/1.1 200 OK
+Content-Type: application/xml; charset=UTF-8;action="http://services.samples/SimpleStockQuoteServicePortType/getQuoteResponse";
+Date: Tue, 24 Apr 2007 14:42:11 GMT
+Server: Synapse-HttpComponents-NIO
+Transfer-Encoding: chunked
+Connection: Keep-Alive
+
+2b3
+<ns:getQuoteResponse xmlns:ns="http://services.samples/xsd">
+ <ns:return>
+ <ns:change>3.7730036841862384</ns:change>
+ <ns:earnings>-9.950236235550818</ns:earnings>
+ <ns:high>-80.23868444613285</ns:high>
+ <ns:last>80.50750970812187</ns:last>
+ <ns:lastTradeTimestamp>Tue Apr 24 20:42:11 LKT 2007</ns:lastTradeTimestamp>
+ <ns:low>-79.67368355714606</ns:low>
+ <ns:marketCap>4.502043663670823E7</ns:marketCap>
+ <ns:name>IBM Company</ns:name>
+ <ns:open>-80.02229531286982</ns:open>
+ <ns:peRatio>25.089295161182022</ns:peRatio>
+ <ns:percentageChange>4.28842665653824</ns:percentageChange>
+ <ns:prevClose>87.98107059692451</ns:prevClose>
+ <ns:symbol>IBM</ns:symbol>
+ <ns:volume>19941</ns:volume>
+ </ns:return>
+</ns:getQuoteResponse></div>
+
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample153.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample153.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample153.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample153.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 153</title>
+ </properties>
+ <body>
+ <section name="Sample 153: Routing the Messages without Processing the Security Headers">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <proxy name="StockQuoteProxy">
+ <target>
+ <inSequence>
+ <property name="preserveProcessedHeaders" value="true"/>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SecureStockQuoteService"/>
+ </endpoint>
+ </send>
+ </inSequence>
+ <outSequence>
+ <send/>
+ </outSequence>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+ </proxy>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate the ability of Synapse to pass SOAP messages through without removing
+ already processed headers
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Download and install the Java Cryptography Extension (JCE) unlimited
+ strength policy files for your JDK
+ </li>
+ <li>
+ Deploy the SecureStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 153 (repository/conf/sample/synapse_sample_153.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 153<br/>
+ Windows: synapse.bat -sample 153
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ In this sample the proxy service will receive secured messages with security
+ headers which are flagged 'MustUnderstand'. But since the element 'enableSec'
+ is not present in the proxy configuration, Synapse will not engage Apache Rampart
+ on this proxy service. It is expected that a MustUnderstand failure exception
+ on the AxisEngine would occur before the message arrives at mediation engine.
+ But Synapse handles this message and gets it through by setting all the
+ MustUnderstand headers which are not processed as processed. This will enable
+ Synapse to route the messages without reading the Security headers (just routing
+ the messages from client to service, both of which are secured). To execute the
+ client, send a stock quote request to the proxy service, and sign and encrypt
+ the request by specifying the client side security policy as follows:
+ </p>
+ <div class="command">ant stockquote -Dtrpurl=http://localhost:8280/services/StockQuoteProxy -Dpolicy=./../../repository/conf/sample/resources/policy/client_policy_3.xml</div>
+ <p>
+ By following through the debug logs or TCPMon output, you can see that the
+ request received by the proxy service was signed and encrypted. Also, looking
+ up the WSDL of the proxy service by requesting the URL http://localhost:8280/services/StockQuoteProxy?wsdl
+ reveals that the security policy attachments are not there and security is not engaged.
+ When sending the message to the backend service, you can verify that the security
+ headers were there as in the original message to Synapse from client, and that
+ the response received does use WS-Security, and forwarded back to the client
+ without any modification. You should note that this won't be a security hole
+ because the message inside Synapse is signed and encrypted and can only be
+ forwarded to a secure service.
+ </p>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample154.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample154.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample154.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample154.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 154</title>
+ </properties>
+ <body>
+ <section name="Sample 154: Load Balancing with Proxy Services">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <proxy name="LBProxy" transports="http" startOnLoad="true">
+ <target faultSequence="errorHandler">
+ <inSequence>
+ <send>
+ <endpoint>
+ <session type="simpleClientSession"/>
+ <loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
+ <endpoint>
+ <address uri="http://localhost:9001/services/LBService1">
+ <enableAddressing/>
+ <suspendDurationOnFailure>20</suspendDurationOnFailure>
+ </address>
+ </endpoint>
+ <endpoint>
+ <address uri="http://localhost:9002/services/LBService1">
+ <enableAddressing/>
+ <suspendDurationOnFailure>20</suspendDurationOnFailure>
+ </address>
+ </endpoint>
+ <endpoint>
+ <address uri="http://localhost:9003/services/LBService1">
+ <enableAddressing/>
+ <suspendDurationOnFailure>20</suspendDurationOnFailure>
+ </address>
+ </endpoint>
+ </loadbalance>
+ </endpoint>
+ </send>
+ <drop/>
+ </inSequence>
+ <outSequence>
+ <send/>
+ </outSequence>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_2.wsdl"/>
+ </proxy>
+
+ <sequence name="errorHandler">
+ <makefault response="true">
+ <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/>
+ <reason value="COULDN'T SEND THE MESSAGE TO THE SERVER."/>
+ </makefault>
+ <send/>
+ </sequence>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate how to use a proxy service as a load balancer
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the LoadbalanceFailoverService in the sample Axis2 server (go to
+ samples/axis2Server/src/LoadbalanceFailoverService and run 'ant')
+ </li>
+ <li>
+ Start 3 instances of the Axis2 server on different ports as follows
+ <div class="command">./axis2server.sh -http 9001 -https 9005 -name MyServer1<br/>
+./axis2server.sh -http 9002 -https 9006 -name MyServer2<br/>
+./axis2server.sh -http 9003 -https 9007 -name MyServer3</div>
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 154 (repository/conf/sample/synapse_sample_154.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 154<br/>
+ Windows: synapse.bat -sample 154
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ This sample is similar to <a href="sample54.html">sample 54</a>. The only
+ notable difference is the use of a proxy service.
+ </p>
+ <p>
+ Execute the client as follows.
+ </p>
+ <div class="command">ant loadbalancefailover -Dmode=session -Dtrpurl=http://localhost:8280/services/LBProxy</div>
+ <p>
+ You will get an output similar to the following.
+ </p>
+ <div class="consoleOutput">[java] Request: 1 Session number: 1 Response from server: MyServer3
+[java] Request: 2 Session number: 2 Response from server: MyServer2
+[java] Request: 3 Session number: 0 Response from server: MyServer1
+[java] Request: 4 Session number: 2 Response from server: MyServer2
+[java] Request: 5 Session number: 1 Response from server: MyServer3
+[java] Request: 6 Session number: 2 Response from server: MyServer2
+[java] Request: 7 Session number: 2 Response from server: MyServer2
+[java] Request: 8 Session number: 1 Response from server: MyServer3
+[java] Request: 9 Session number: 0 Response from server: MyServer1
+[java] Request: 10 Session number: 0 Response from server: MyServer1
+... </div>
+ <p>
+ You can see that session ID 0 is always directed to the server named MyServer1.
+ That means session ID 0 is bound to MyServer1. Similarly session 1 and 2 are bound
+ to MyServer3 and MyServer2 respectively.
+ </p>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample155.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample155.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample155.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample155.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 155</title>
+ </properties>
+ <body>
+ <section name="Sample 155: Dual Channel Invocation on Client Side and Server Side">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <proxy name="StockQuoteProxy">
+ <target>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService">
+ <enableAddressing separateListener="true"/>
+ </address>
+ </endpoint>
+ <outSequence>
+ <send/>
+ </outSequence>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+ </proxy>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ <a href="sample13.html">Sample 13</a> show cased how to perform dual channel
+ invocations on the client side. This sample demonstrates how to perform dual
+ channel invocations on both client side and server side, using proxy services.
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 155 (repository/conf/sample/synapse_sample_155.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 155<br/>
+ Windows: synapse.bat -sample 155
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ This sample will show the action of the dual channel invocation between client
+ and Synapse as well as between Synapse and the Axis2 server. Note that if you
+ want to enable dual channel invocation you need to set the separateListener
+ attribute to true on the enableAddressing element of the endpoint.
+ </p>
+ <p>
+ Execute the stock quote client in the dual channel mode as follows:
+ </p>
+ <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=dualquote</div>
+ <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 in dual channel mode. If you observe the message flow using TCPmon,
+ you will see that on the channel you send the request to Synapse, the response has
+ been written as HTTP 202 Accepted, where as the real response from Synapse
+ comes 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>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample156.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample156.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample156.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample156.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 156</title>
+ </properties>
+ <body>
+ <section name="Sample 156: Service Integration with Specifying the Receiving Sequence">
+ <div class="xmlConf"><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></div>
+ <subsection name="Objective">
+ <p>
+ Synapse is capable of mediating requests among multiple services and managing
+ complex message flows thereby acting as a lightweight orchestration engine. This
+ sample demonstrates how to easily integrate multiple services with Synapse using
+ the 'receiving sequence' feature of Synapse.
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server
+ </li>
+ <li>
+ Deploy the SecureStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 156 (repository/conf/sample/synapse_sample_156.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 156<br/>
+ Windows: synapse.bat -sample 156
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ This sample includes a proxy service which first forwards the client request to
+ the SecureStockQuoteService. Once a response has been received from this service,
+ Synapse will turn around and invoke the SimpleStockQuoteService. To do this proxy
+ service must hold on to the original request in memory. This is done using an
+ enrich mediator. Once Synapse has received a response from the SimpleStockQuoteService
+ it will compare the two responses received from the two services and select the
+ one with the lower stock quote value. This response will be then sent to the
+ client.
+ </p>
+ <p>
+ The important feature to note here is the 'receive' attribute set on the 'send'
+ mediators. This tells Synapse that responses of those send operations should be
+ directed to the sequences referred by the 'receive' attribute. Therefore the
+ response from the SecureStockQuoteService is directed to the sequence named
+ 'SimpleServiceSeq'. Similarly the response from the SimpleStockQuoteService will
+ be handled by the sequence named 'ClientOutSeq'.
+ </p>
+ <p>
+ To try this out, execute the stock quote client as follows:
+ </p>
+ <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy</div>
+ <p>
+ You can confirm that Synapse invokes both services by going through the console
+ output of the Axis2 server. However Axis2 client will receive only one response
+ back. As far as the client is concerned, only one HTTP transaction is taking place.
+ But Synapse does multiple service invocations with the back-end to make the whole
+ integration scenario tick.
+ </p>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample157.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample157.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample157.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample157.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 157</title>
+ </properties>
+ <body>
+ <section name="Sample 157: Conditional Router Mediator for Implementing Complex Routing Scenarios">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+ <proxy name="StockQuoteProxy" transports="https http" startOnLoad="true" trace="disable">
+ <target>
+ <inSequence>
+ <conditionalRouter continueAfter="false">
+ <conditionalRoute breakRoute="false">
+ <condition>
+ <match xmlns="" type="header" source="foo" regex="bar.*"/>
+ </condition>
+ <target sequence="cnd1_seq"/>
+ </conditionalRoute>
+
+ <conditionalRoute breakRoute="false">
+ <condition>
+ <and xmlns="">
+ <match type="header" source="my_custom_header1" regex="foo.*"/>
+ <match type="url" regex="/services/StockQuoteProxy.*"/>
+ </and>
+ </condition>
+ <target sequence="cnd2_seq"/>
+ </conditionalRoute>
+
+ <conditionalRoute breakRoute="false">
+ <condition>
+ <and xmlns="">
+ <match type="header" source="my_custom_header2" regex="bar.*"/>
+ <equal type="param" source="qparam1" value="qpv_foo"/>
+ <or>
+ <match type="url" regex="/services/StockQuoteProxy.*"/>
+ <match type="header" source="my_custom_header3" regex="foo.*"/>
+ </or>
+ <not>
+ <equal type="param" source="qparam2" value="qpv_bar"/>
+ </not>
+ </and>
+ </condition>
+ <target sequence="cnd3_seq"/>
+ </conditionalRoute>
+ </conditionalRouter>
+ </inSequence>
+ <outSequence>
+ <send/>
+ </outSequence>
+ </target>
+ </proxy>
+
+ <sequence name="cnd1_seq">
+ <log level="custom">
+ <property name="MSG_FLOW" value="Condition (I) Satisfied"/>
+ </log>
+ <sequence key="send_seq"/>
+ </sequence>
+ <sequence name="cnd2_seq">
+ <log level="custom">
+ <property name="MSG_FLOW" value="Condition (II) Satisfied"/>
+ </log>
+ <sequence key="send_seq"/>
+ </sequence>
+ <sequence name="cnd3_seq">
+ <log level="custom">
+ <property name="MSG_FLOW" value="Condition (III) Satisfied"/>
+ </log>
+ <sequence key="send_seq"/>
+ </sequence>
+
+ <sequence name="send_seq">
+ <log level="custom">
+ <property name="DEBUG" value="Condition Satisfied"/>
+ </log>
+ <send>
+ <endpoint name="simple">
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </sequence>
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Conditional router mediator can be used to implement complex routing rules in
+ Synapse. It can route messages to various endpoints based on URLs, query parameters
+ and transport headers. This sample demonstrates how to use the conditional router
+ mediator within a proxy service to build a smart routing proxy.
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server a d start
+ Axis2 server.
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 157 (repository/conf/sample/synapse_sample_157.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 157<br/>
+ Windows: synapse.bat -sample 157
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ We will be using 'curl' as the client in this scenario. <a href="http://curl.haxx.se/">Curl</a>
+ is a neat little command line tool that can be used to generate various types
+ of HTTP requests (among other things).
+ </p>
+ <p>
+ First create a sample input file named stockQuoteReq.xml with the following
+ content.
+ </p>
+ <div class="xmlConf"><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://services.samples" xmlns:xsd="http://services.samples/xsd">
+ <soap:Header/>
+ <soap:Body>
+ <ser:getQuote>
+ <ser:request>
+ <xsd:symbol>IBM</xsd:symbol>
+ </ser:request>
+ </ser:getQuote>
+ </soap:Body>
+</soap:Envelope></div>
+ <p>
+ Invoke curl as follows to see header based routing feature in action.
+ </p>
+ <div class="command">curl -d @stockQuoteReq.xml -H "Content-Type: application/soap+xml;charset=UTF-8" -H "foo:bar" "http://localhost:8280/services/StockQuoteProxy"</div>
+ <p>
+ This sends a HTTP request with a custom header named 'foo'. Proxy service will
+ detect this header and print a custom log message confirming the receipt of the
+ request.
+ </p>
+ <p>
+ Now invoke curl as follows to test a combination header and URL based routing.
+ </p>
+ <div class="command">curl -d @stockQuoteReq.xml -H "Content-Type: application/soap+xml;charset=UTF-8" -H "my_custom_header1:foo1" "http://localhost:8280/services/StockQuoteProxy"</div>
+ <p>
+ Finally invoke curl as follows to test routing based on complex conditions.
+ </p>
+ <div class="command">curl -d @stockQuoteReq.xml -H "Content-Type: application/soap+xml;charset=UTF-8" -H "my_custom_header2:bar" -H "my_custom_header3:foo" "http://localhost:8280/services/StockQuoteProxy?qparam1=qpv_foo&qparam2=qpv_foo2"</div>
+ <p>
+ In each case Synapse will log a different log entry because the conditional router
+ mediator uses different sequences to process the three messages.
+ </p>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample158.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample158.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample158.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample158.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 158</title>
+ </properties>
+ <body>
+ <section name="Sample 156: Exposing a SOAP service over JSON">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <proxy name="JSONProxy" transports="http https">
+ <target>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ <inSequence>
+ <log level="full"/>
+ <xslt key="in_transform"/>
+ <property name="messageType" scope="axis2" value="text/xml"/>
+ </inSequence>
+ <outSequence>
+ <log level="full"/>
+ <xslt key="out_transform"/>
+ <property name="messageType" scope="axis2" value="application/json"/>
+ <send/>
+ </outSequence>
+ </target>
+ </proxy>
+
+ <localEntry key="in_transform">
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
+ xmlns:m0="http://services.samples" version="2.0" exclude-result-prefixes="m0 fn">
+ <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
+ <xsl:template match="*">
+ <xsl:element name="{local-name()}" namespace="http://services.samples">
+ <xsl:copy-of select="attribute::*"/>
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+ </xsl:stylesheet>
+ </localEntry>
+
+ <localEntry key="out_transform">
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
+ <xsl:template match="*">
+ <xsl:element name="{local-name()}">
+ <xsl:apply-templates/>
+ </xsl:element>
+ </xsl:template>
+ </xsl:stylesheet>
+ </localEntry>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate the ability to switch between JSON and XML/SOAP content interchange formats
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Setup Synapse and the sample Axis2 client for JSON (Refer Synapse <a href="setup/script.html#json">Samples Setup Guide</a> for details)
+ </li>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 158 (repository/conf/sample/synapse_sample_158.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 158<br/>
+ Windows: synapse.bat -sample 158
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <div class="command">ant jsonclient -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/services/JSONProxy</div>
+ <p>JSON client will send a stockquote request to Synapse using the
+ JSON content interchange format. Synapse will trnasform it into a SOAP
+ request and forward to the Axis2 server. The SOAP response from the
+ Axis2 server will be converted into a JSON message and sent back to the
+ JSON client.</p>
+ <p>You may use a tool like TCPMon to monitor the JSON requests sent
+ over the wire. A sample JSON request and response is shown below:</p>
+
+ <div class="consoleOutput">{"getQuote":{"request":{"symbol":"IBM"}}}</div>
+
+ <div class="consoleOutput">{"getQuoteResponse":{"return":{"change":3.853593376681722,"earnings":12.802850763714854,"high":67.92488310190126,"last":66.14619264746406,"lastTradeTimestamp":"Mon Aug 23 16:48:40 IST 2010","low":-66.04000424423522,"marketCap":-9334516.42324327,"name":"IBM Company","open":-64.61950137150009,"peRatio":-19.78600441437058,"percentageChange":5.411779328273005,"prevClose":71.2075112994578,"symbol":"IBM","volume":16842}}}</div>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample2.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample2.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample2.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample2.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 2</title>
+ </properties>
+ <body>
+ <section name="Sample 2: CBR with Switch Case Mediator">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <sequence name="main">
+ <switch source="//m0:getQuote/m0:request/m0:symbol" xmlns:m0="http://services.samples">
+ <case regex="IBM">
+ <!-- the property mediator sets a local property on the *current* message -->
+ <property name="symbol" value="Great stock - IBM"/>
+ </case>
+ <case regex="MSFT">
+ <property name="symbol" value="Are you sure? - MSFT"/>
+ </case>
+ <default>
+ <!-- it is possible to assign the result of an XPath expression as well -->
+ <property name="symbol" expression="fn:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"/>
+ </default>
+ </switch>
+ <log level="custom">
+ <!-- the get-property() XPath extension function allows the lookup of local message properties
+ as well as properties from the Axis2 or Transport contexts (i.e. transport headers) -->
+ <property name="symbol" expression="get-property('symbol')"/>
+ <!-- the get-property() function supports the implicit message headers To/From/Action/FaultTo/ReplyTo -->
+ <property name="epr" expression="get-property('To')"/>
+ </log>
+ <!-- Send the messages where they are destined to (i.e. the 'To' EPR of the message) -->
+ <send/>
+ </sequence>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Introduction to the switch-case mediator and manipulating properties set on the
+ messages.
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 2 (repository/conf/sample/synapse_sample_2.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 2<br/>
+ Windows: synapse.bat -sample 2
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ Execute the sample Axis2 client in the smart client using different symbols
+ such as IBM, MSFT and SUN.
+ </p>
+ <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=IBM</div>
+ <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=MSFT</div>
+ <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=SUN</div>
+
+ <p>
+ When the symbol IBM is requested, viewing the mediation logs you will see that
+ the switch mediator's first case for 'IBM' is executed and a local property named
+ 'symbol' is set to 'Great stock - IBM'. Subsequently this local property value
+ is looked up by the log mediator and logged using the 'get-property()' XPath
+ extension function.
+ </p>
+ <div class="consoleOutput">INFO LogMediator - symbol = Great stock - IBM, epr = http://localhost:9000/axis2/services/SimpleStockQuoteService</div>
+
+ <p>
+ Similarly for the symbol 'MSFT' the second case statement in the switch mediator
+ will be executed which will result in the following log.
+ </p>
+ <div class="consoleOutput">INFO LogMediator - symbol = Are you sure? - MSFT, epr = http://localhost:9000/axis2/services/SimpleStockQuoteService</div>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample200.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample200.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample200.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample200.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 200</title>
+ </properties>
+ <body>
+ <section name="Sample 200: Engaging WS-Security on Proxy Services">
+ <div class="xmlConf"><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>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </inSequence>
+ <outSequence>
+ <send/>
+ </outSequence>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+ <enableSec/>
+ <policy key="sec_policy"/>
+ </proxy>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrates how to secure a proxy service using WS-Security and WS-Policy
+ standards
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Download and install the Java Cryptography Extension (JCE) unlimited
+ strength policy files for your JDK
+ </li>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 200 (repository/conf/sample/synapse_sample_200.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 200<br/>
+ Windows: synapse.bat -sample 200
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ The proxy service expects to receive a signed and encrypted message as specified
+ by the security policy. Please see Apache Rampart and Axis2 documentation on the
+ format of the policy file. The element 'enableSec' specifies that Apache Rampart
+ should be engaged on this proxy service. Hence if Rampart rejects any request
+ messages that does not conform to the specified policy, those messages will
+ never reach the 'inSequence' to be processed. To execute the client, send a stock
+ quote request to the proxy service, and sign and encrypt the request by specifying
+ the client side security policy as follows:
+ </p>
+ <div class="command">ant stockquote -Dtrpurl=http://localhost:8280/services/StockQuoteProxy -Dpolicy=./../../repository/conf/sample/resources/policy/client_policy_3.xml</div>
+ <p>
+ By following through the debug logs or TCPMon output, you can see that the
+ request received by the proxy service is signed and encrypted. Also, looking up
+ the WSDL of the proxy service by requesting the URL http://localhost:8280/services/StockQuoteProxy?wsdl
+ reveals that the security policy is attached to the provided base WSDL. When
+ sending the message to the backend service, you can verify that the security
+ headers are removed. The response received from Axis2 does not use WS-Security,
+ but the response forwarded back to the client is signed and encrypted as
+ expected by the client.
+ </p>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample201.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample201.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample201.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample201.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 201</title>
+ </properties>
+ <body>
+ <section name="Sample 201: Reliable Communication Between the Client and Proxy Services Using WS-ReliableMessaging">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <proxy name="StockQuoteProxy">
+ <target>
+ <inSequence>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </inSequence>
+ <outSequence>
+ <send/>
+ </outSequence>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+ <enableRM/>
+ </proxy>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Show case how to engage WS-ReliableMessaging on proxy services so that the
+ communication between client and the proxy service is reliable
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 201 (repository/conf/sample/synapse_sample_201.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 201<br/>
+ Windows: synapse.bat -sample 201
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ In the above configuration, a proxy service is created with WS-RM enabled using
+ the <enableRM/> tag. Therefore, this proxy service is capable of
+ communicating with a WS-RM client. It also removes the WS-RM headers in the
+ inSequence before the message is sent to the backend server. This is required as
+ the reliable messaging is applicable only between the client and Synapse. Now
+ start the client with WS-RM as follows:
+ </p>
+ <div class="command">ant stockquote -Dsymbol=IBM -Dmode=quote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dwsrm=true</div>
+ <p>
+ In this case, client sends a WS-RM enabled request to Synapse where Synapse sends
+ normal requests to the server. This can be observed by examining the wire level
+ messages between the client and Synapse. These messages would be similar to the
+ wire level messages shown in <a href="sample101.html">sample 101</a>.
+ </p>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample202.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample202.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample202.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample202.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 202</title>
+ </properties>
+ <body>
+ <section name="Sample 202: ">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <proxy name="StockQuoteProxy">
+ <target>
+ <inSequence>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </inSequence>
+ <outSequence>
+ <send/>
+ </outSequence>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+ <enableRM/>
+ </proxy>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 202 (repository/conf/sample/synapse_sample_202.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 202<br/>
+ Windows: synapse.bat -sample 202
+ </div>
+ </li>
+ </ul>
+ </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>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample250.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample250.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample250.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample250.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 250</title>
+ </properties>
+ <body>
+ <section name="Sample 250:Introduction to Transport Switching - JMS to HTTP/S ">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <proxy name="StockQuoteProxy" transports="jms">
+ <target>
+ <inSequence>
+ <property action="set" name="OUT_ONLY" value="true"/>
+ </inSequence>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ <outSequence>
+ <send/>
+ </outSequence>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+ <parameter name="transport.jms.ContentType">
+ <rules>
+ <jmsProperty>contentType</jmsProperty>
+ <default>application/xml</default>
+ </rules>
+ </parameter>
+ </proxy>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate the ability of Synapse to perform transport switching (i.e. receiving
+ messages over one transport and forwarding them over a different transport)
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ 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 <a href="setup/jms.html#pre">JMS setup guide</a>
+ for information on how to run ActiveMQ.)
+ </li>
+ <li>
+ Enable the JMS transport receiver of Synapse (Refer
+ <a href="setup/jms.html#listener">JMS setup guide</a> for more details)
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 250 (repository/conf/sample/synapse_sample_250.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 250<br/>
+ Windows: synapse.bat -sample 250
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ In this sample we are using a proxy service exposed over JMS (note the transports=jms
+ attribute). If you check the WSDL of the proxy service using a web browser you
+ will notice that it only has JMS endpoints.
+ </p>
+ <p>
+ Run the sample JMS client by switching to the samples/axis2Client directory and
+ executing the following command.
+ </p>
+ <div class="command">ant jmsclient -Djms_type=pox -Djms_dest=dynamicQueues/StockQuoteProxy -Djms_payload=MSFT</div>
+ <p>
+ This will send a plain XML formatted place order request to a JMS queue named
+ 'StockQuoteProxy'. Synapse will be polling on this queue for any incoming messages
+ so it will pick up the request. If you run Synapse in the DEBUG mode, following
+ entry will be printed on the console.
+ </p>
+ <div class="consoleOutput">[JMSWorker-1] DEBUG ProxyServiceMessageReceiver -Proxy Service StockQuoteProxy received a new message...</div>
+ <p>
+ Then Synapse will mediate the request through the service bus and forward it to
+ the sample Axis2 server over HTTP. Axis2 server will print the following entry
+ on the console when it receives the request.
+ </p>
+ <div class="consoleOutput">Accepted order for : 16517 stocks of MSFT at $ 169.14622538721846</div>
+ <p>
+ Note that the operation is out-only and no response is sent back to the client.
+ The transport.jms.ContentType property is necessary to allow the JMS transport
+ to determine the content type of incoming messages. With the given configuration
+ it will first try to read the content type from the 'contentType' message property
+ and fall back to 'application/xml' (i.e. POX) if this property is not set. Note
+ that the JMS client used in this example doesn't send any content type
+ information.
+ </p>
+ <p>
+ It is also important to note that the name of the source JMS queue is same as the
+ name of the proxy service (StockQuoteProxy). This is the default behavior of
+ Synapse. Each proxy service by default listens on a JMS queue which has the same
+ name as the service. It is possible to instruct a JMS proxy service to listen to
+ an already existing destination without creating a new one. To do this, use the
+ parameter elements on the proxy service definition to specify the destination
+ and connection factory information. An example is given below.
+ </p>
+ <div class="xmlConf"><parameter name="transport.jms.Destination">dynamicTopics/something.TestTopic</parameter></div>
+ <p>
+ With the above parameter in the proxy configuration, proxy service will listen
+ on a JMS topic named 'something.TestTopic' for incoming requests.
+ </p>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Added: synapse/branches/2.1/src/site/xdoc/userguide/samples/sample251.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/src/site/xdoc/userguide/samples/sample251.xml?rev=1222320&view=auto
==============================================================================
--- synapse/branches/2.1/src/site/xdoc/userguide/samples/sample251.xml (added)
+++ synapse/branches/2.1/src/site/xdoc/userguide/samples/sample251.xml Thu Dec 22 16:16:02 2011
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<document>
+ <properties>
+ <title>Apache Synapse - Sample 251</title>
+ </properties>
+ <body>
+ <section name="Sample 251: Switching from HTTP/S to JMS">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <proxy name="StockQuoteProxy" transports="http">
+ <target>
+ <endpoint>
+ <address
+ uri="jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"/>
+ </endpoint>
+ <inSequence>
+ <property action="set" name="OUT_ONLY" value="true"/>
+ </inSequence>
+ <outSequence>
+ <send/>
+ </outSequence>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+ </proxy>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ This sample demonstrates receiving messages over HTTP/S and forwarding them to
+ a JMS queue
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Setup and start a JMS broker (Apache ActiveMQ can be used as the
+ JMS broker for this scenario. Refer <a href="setup/jms.html#pre">JMS setup guide</a>
+ for information on how to run ActiveMQ.)
+ </li>
+ <li>
+ Enable the JMS transport receiver of the sample Axis2 server (Refer
+ <a href="setup/jms.html#server">JMS setup guide</a> for details)
+ </li>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2 (Since
+ the JMS receiver is enabled, Axis2 will start polling on a JMS queue)
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 251 (repository/conf/sample/synapse_sample_251.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 251<br/>
+ Windows: synapse.bat -sample 251
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ This Synapse configuration creates a proxy service over HTTP and forwards
+ received messages to a JMS queue. To test this functionality, send a place order
+ request to Synapse over HTTP as follows.
+ </p>
+ <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=placeorder -Dsymbol=MSFT</div>
+ <p>
+ Note that the target endpoint of the proxy service points to a JMS queue in the
+ ActiveMQ broker.
+ </p>
+ <div class="consoleOutput">jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=
+QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&
+java.naming.provider.url=tcp://localhost:61616</div>
+ <p>
+ The sample Axis2 server will pick up the message from the JMS queue and print the
+ following log entry.
+ </p>
+ <div class="consoleOutput">Accepted order for : 18406 stocks of MSFT at $ 83.58806051152119</div>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file