You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ka...@apache.org on 2011/12/23 12:55:09 UTC
svn commit: r1222651 [6/14] - in /synapse/branches/2.1: ./
modules/distribution/ modules/distribution/src/main/assembly/
modules/documentation/ modules/documentation/src/
modules/documentation/src/site/ modules/documentation/src/site/resources/
modules...
Added: synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample102.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample102.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample102.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample102.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,74 @@
+<?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 102</title>
+ </properties>
+ <body>
+ <section name="Sample 102:Reliable message exchange between Synapse and the back-end server using WS-ReliableMessaging 1.1 ">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <sequence name="main">
+ <in>
+ <RMSequence single="true" version="1.1"/>
+ <send>
+ <endpoint name="reliable">
+ <address uri="http://localhost:9000/services/ReliableStockQuoteService">
+ <enableRM/>
+ <enableAddressing/>
+ </address>
+ </endpoint>
+ </send>
+ </in>
+ <out>
+ <send/>
+ </out>
+ </sequence>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate the message exchange between Synapse and the server using WS-ReliableMessaging (WS-RM) - 1.1
+ </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 102 (repository/conf/sample/synapse_sample_102.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 102<br/>
+ Windows: synapse.bat -sample 102
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>This sample is as same as the previous one except it uses WS-RM 1.1 version where as the previous sample is using the RM version 1.0</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/modules/documentation/src/site/xdoc/userguide/samples/sample11.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample11.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample11.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample11.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,90 @@
+<?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 11</title>
+ </properties>
+ <body>
+ <section name="Sample 11: A Full Registry based Configuration, and Sharing Configuration Between Multiple Instances">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <registry provider="org.apache.synapse.registry.url.SimpleURLRegistry">
+ <parameter name="root">file:./repository/conf/sample/resources/</parameter>
+ <parameter name="cachableDuration">15000</parameter>
+ </registry>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrating the ability of Synapse to load the entire configuration from
+ a remote registry. This approach can also be used to share a single configuration
+ between multiple Synapse instances by pointing all the Synapse instances to the
+ same URL registry.
+ </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 11 (repository/conf/sample/synapse_sample_11.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 11<br/>
+ Windows: synapse.bat -sample 11
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ This example shows a full registry based Synapse configuration. This makes it
+ possible to easily start multiple instances of Synapse sharing a single configuration
+ in a clustered environment. The Synapse configuration of a given node hosting
+ Synapse simply points to the registry and looks up the actual configuration by
+ requesting the key 'synapse.xml'.
+ </p>
+ <p>(Note: Full registry based configuration is not dynamic atleast for the moment -
+ i.e. it is not reloading itself)</p>
+ <p>
+ Invoke the client as follows.
+ </p>
+ <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
+ <p>
+ Synapse will generate the following log output.
+ </p>
+ <div class="consoleOutput">[HttpServerWorker-1] INFO LogMediator - message = This is a dynamic Synapse configuration</div>
+ <p>The actual synapse.xml loaded from the registry is: </p>
+ <div class="xmlConf"><!-- a registry based Synapse configuration -->
+<definitions xmlns="http://synapse.apache.org/ns/2010/04/configuraiton">
+ <log level="custom">
+ <property name="message" value="This is a dynamic Synapse configuration $$$"/>
+ </log>
+ <send/>
+</definitions></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/modules/documentation/src/site/xdoc/userguide/samples/sample12.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample12.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample12.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample12.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,92 @@
+<?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 12</title>
+ </properties>
+ <body>
+ <section name="Sample 12: One-way Messaging / Fire-and-Forget Through Synapse">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <sequence name="main">
+ <!-- filtering of messages with XPath and regex matches -->
+ <filter source="get-property('To')" regex=".*/StockQuote.*">
+ <then>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ <drop/>
+ </then>
+ </filter>
+ <send/>
+ </sequence>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate the ability to perform one-way invocations (out-only) through
+ Synapse.
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ This sample makes use of the configuration used in <a href="sample1.html">sample 1</a>.
+ So start Synapse using the configuration numbered 1 (repository/conf/sample/synapse_sample_1.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 1<br/>
+ Windows: synapse.bat -sample 1
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ In this example we will invoke the one-way 'placeOrder' operation on the
+ SimpleStockQuoteService using the sample client which uses the Axis2
+ ServiceClient.fireAndForget() API. To send a placeOrder request from the sample
+ client, execute the following command.
+ </p>
+ <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=placeorder</div>
+
+ <p>
+ Going through the Axis2 server logs, you will notice the following entry, which
+ confirms that Axis2 accepted the in-only request.
+ </p>
+ <div class="consoleOutput">SimpleStockQuoteService :: Accepted order for : 7482 stocks of IBM at $ 169.27205579038733</div>
+
+ <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>
+ </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/modules/documentation/src/site/xdoc/userguide/samples/sample13.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample13.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample13.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample13.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,93 @@
+<?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 13</title>
+ </properties>
+ <body>
+ <section name="Sample 13: Dual Channel Invocations Through Synapse">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <sequence name="main">
+ <!-- log all attributes of messages passing through -->
+ <log level="full"/>
+
+ <!-- Send the message to implicit destination -->
+ <send/>
+ <sequence/>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate the ability to perform dual channel invocations through
+ Synapse (asynchronous notification).
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+ <li>
+ This sample makes use of the configuration used in <a href="sample0.html">sample 0</a>.
+ So start Synapse using the configuration numbered 0 (repository/conf/sample/synapse_sample_0.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 0<br/>
+ Windows: synapse.bat -sample 0
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ Execute the client as follows.
+ </p>
+ <div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
+ <p>
+ This example invokes the same 'getQuote' operation on the SimpleStockQuoteService
+ using the custom client which uses the Axis2 ServiceClient API with useSeparateListener
+ set to 'true', so that the response is coming through a different channel than
+ the one which is used to send the request. Note the following log thrown out
+ by the sample client.
+ </p>
+ <div class="consoleOutput">Response received to the callback
+Standard dual channel :: Stock price = $57.16686934968289</div>
+ <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 client 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 gpoing 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>
+ </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/modules/documentation/src/site/xdoc/userguide/samples/sample14.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample14.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample14.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample14.xml Fri Dec 23 11:55:05 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 14</title>
+ </properties>
+ <body>
+ <section name="Sample 14: Sequences and Endpoints as local registry items">
+ <div class="xmlConf"><pre xml:space="preserve"><definitions xmlns="http://ws.apache.org/ns/synapse"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://ws.apache.org/ns/synapse http://synapse.apache.org/ns/2010/04/configuration/synapse_config.xsd">
+
+ <localEntry key="local-enrty-ep-key"
+ src="file:repository/conf/sample/resources/endpoint/dynamic_endpt_1.xml"/>
+
+ <localEntry key="local-enrty-sequence-key">
+ <sequence name="dynamic_sequence">
+ <log level="custom">
+ <property name="message" value="*** Test Message 1 ***"/>
+ </log>
+ </sequence>
+ </localEntry>
+
+ <sequence name="main">
+ <in>
+ <sequence key="local-enrty-sequence-key"/>
+ <send>
+ <endpoint key="local-enrty-ep-key"/>
+ </send>
+ </in>
+ <out>
+ <send/>
+ </out>
+ </sequence>
+
+</definitions></pre></div>
+ <subsection name="Objective">
+ <p>
+ Objective: Sequence and Endpoints as local registry entries
+ </p>
+ </subsection>
+
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Start the Synapse configuration numbered 14: i.e. synapse
+ -sample 14
+ </li>
+ <li>
+ Start the Axis2 server and deploy the SimpleStockQuoteService if
+ not already done
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ Execute the client as follows.
+ </p>
+ <div class="command">ant stockquote -Dtrpurl=http://localhost:8280/</div>
+ <p>This example shows sequences and endpoints fetched from local
+ registry. Thus it is possible to have endpoints sequences as
+ local registry entries including file entries.Execute the
+ following command to see the sample working, where you will be
+ able to see the log statement from the fetched sequence from the
+ local entry and the endpoint will be fetched from the specified
+ file at runtime and be cached in the system
+ </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/modules/documentation/src/site/xdoc/userguide/samples/sample150.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample150.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample150.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample150.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,88 @@
+<?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 150</title>
+ </properties>
+ <body>
+ <section name="Sample 150: Introduction to Proxy Services">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <proxy name="StockQuoteProxy">
+ <target>
+ <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"/>
+ </proxy>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Introduce the concept of proxy services in Synapse
+ </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 150 (repository/conf/sample/synapse_sample_150.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 150<br/>
+ Windows: synapse.bat -sample 150
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ Execute the stock quote client as follows and invoke the proxy service:
+ </p>
+ <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy</div>
+
+ <p>
+ The 'inSequence' or 'endpoint' or both of these would decide how the message
+ would be handled after the proxy service receives the message. In the above
+ example, the request received is forwarded to the sample service hosted on Axis2.
+ The 'outSequence' defines how the response is handled before it is sent back to
+ the client. By default, a proxy service is exposed over all transportss
+ configured for Synapse, unless these are specifically mentioned through the
+ 'transports' attribute.
+ </p>
+ <p>
+ You can also view the WSDL of the proxy service by launching a web browser and
+ navigating to the following URL:
+ </p>
+ <div class="command">http://localhost:8280/services/StockQuoteProxy?wsdl</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/modules/documentation/src/site/xdoc/userguide/samples/sample151.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample151.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample151.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample151.xml Fri Dec 23 11:55:05 2011
@@ -0,0 +1,98 @@
+<?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 151</title>
+ </properties>
+ <body>
+ <section name="Sample 151: Custom Sequences and Endpoints with Proxy Services">
+ <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <localEntry key="proxy_wsdl"
+ src="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+
+ <endpoint name="proxy_2_endpoint">
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+
+ <sequence name="proxy_1">
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </sequence>
+
+ <sequence name="out">
+ <send/>
+ </sequence>
+
+ <proxy name="StockQuoteProxy1">
+ <target inSequence="proxy_1" outSequence="out"/>
+ <publishWSDL key="proxy_wsdl"/>
+ </proxy>
+
+ <proxy name="StockQuoteProxy2">
+ <target endpoint="proxy_2_endpoint" outSequence="out"/>
+ <publishWSDL key="proxy_wsdl"/>
+ </proxy>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate how to use predefined endpoints and sequences in a proxy service
+ </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 151 (repository/conf/sample/synapse_sample_151.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 151<br/>
+ Windows: synapse.bat -sample 151
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ This configuration creates two proxy services. The first proxy service
+ 'StockQuoteProxy1' uses the sequence named 'proxy_1' to process incoming
+ messages and the sequence named 'out' to process outgoing responses. The second
+ proxy service, 'StockQuoteProxy2' is set to directly forward messages to the
+ endpoint named 'proxy_2_endpoint' without any mediation.
+ </p>
+ <p>
+ You can send a stock quote request to each of these proxy services and receive
+ the reply generated by the actual service hosted on the Axis2 server instance.
+ </p>
+ <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy1
+<br/>ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy2</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/modules/documentation/src/site/xdoc/userguide/samples/sample152.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample152.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample152.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample152.xml Fri Dec 23 11:55:05 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/modules/documentation/src/site/xdoc/userguide/samples/sample153.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample153.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample153.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample153.xml Fri Dec 23 11:55:05 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/modules/documentation/src/site/xdoc/userguide/samples/sample154.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample154.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample154.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample154.xml Fri Dec 23 11:55:05 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/modules/documentation/src/site/xdoc/userguide/samples/sample155.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample155.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample155.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample155.xml Fri Dec 23 11:55:05 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/modules/documentation/src/site/xdoc/userguide/samples/sample156.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample156.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample156.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample156.xml Fri Dec 23 11:55:05 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/modules/documentation/src/site/xdoc/userguide/samples/sample157.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample157.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample157.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample157.xml Fri Dec 23 11:55:05 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/modules/documentation/src/site/xdoc/userguide/samples/sample158.xml
URL: http://svn.apache.org/viewvc/synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample158.xml?rev=1222651&view=auto
==============================================================================
--- synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample158.xml (added)
+++ synapse/branches/2.1/modules/documentation/src/site/xdoc/userguide/samples/sample158.xml Fri Dec 23 11:55:05 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