blob: 32f2e1845112751a9421069f8549a17f6eb53932 [file] [log] [blame]
<?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 0</title>
</properties>
<body>
<section name="Sample 0: Introduction to Synapse">
<div class="xmlConf">&lt;definitions xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;
&lt;sequence name="main"&gt;
&lt;!-- log all attributes of messages passing through --&gt;
&lt;log level=&quot;full&quot;/&gt;
&lt;!-- Send the message to implicit destination --&gt;
&lt;send/&gt;
&lt;sequence/&gt;
&lt;/definitions&gt;</div>
<subsection name="Objective">
<p>
Introduction to Synapse - Shows how Synape can be configured to log and pass
messages through.
</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 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">
<h4>Smart Client Mode</h4>
<p>
Execute the client in the smart client mode using the following command.
</p>
<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div>
<p>
By tracing the execution of Synapse with the log output level set to DEBUG,
you will see that the client request is arriving at Synapse with a WS-Addressing 'To'
header set to EPR http://localhost:9000/services/SimpleStockQuoteService. The
Synapse engine logs the message at the 'full' log level (i.e. all the
message headers and the body) and then sends it to its explicit 'To'
address which is http://localhost:9000/services/SimpleStockQuoteService.
You will see a log entry in the Axis2 server console confirming that the message
got routed to the sample server and the service hosted at the server generated
a stock quote for the requested symbol.
</p>
<div class="consoleOutput">Sat Nov 18 21:01:23 IST 2006 SimpleStockQuoteService :: Generating quote for : IBM</div>
<p>
The response message generated by the service is received by Synapse,
and flows through the same mediation rules, which log the response and
send back to the client. On the client console you should see an output
similar to the following based on the message received by the client.
</p>
<div class="consoleOutput">Standard :: Stock price = $95.26454380258552</div>
<h4>Proxy Client Mode</h4>
<p>
Execute the sample Axis2 client as follows to run it in the proxy mode.
</p>
<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dprxurl=http://localhost:8280/</div>
<p>
You will see the exact same behaviour as per the previous example when you run
this scenario. However this time the client sends the message to the Axis2 server
using Synapse as a HTTP proxy.
</p>
<p>
The Axis2 client supports another mode of operation known as the 'dumb client
mode'. This will be addressed in <a href="sample1.html">sample 1</a>.
</p>
</subsection>
</section>
<p><a href="../samples.html">Back to Catalog</a></p>
</body>
</document>