You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ja...@apache.org on 2005/06/06 13:22:39 UTC

svn commit: r180293 - /webservices/axis/trunk/java/xdocs/userguide.html

Author: jaliya
Date: Mon Jun  6 04:22:36 2005
New Revision: 180293

URL: http://svn.apache.org/viewcvs?rev=180293&view=rev
Log:
Modified the userguide

Modified:
    webservices/axis/trunk/java/xdocs/userguide.html

Modified: webservices/axis/trunk/java/xdocs/userguide.html
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/xdocs/userguide.html?rev=180293&r1=180292&r2=180293&view=diff
==============================================================================
--- webservices/axis/trunk/java/xdocs/userguide.html (original)
+++ webservices/axis/trunk/java/xdocs/userguide.html Mon Jun  6 04:22:36 2005
@@ -81,45 +81,11 @@
   <li> Complete XML infoset support for AXIOM</li>
   <li> Implementation of other transports. e.g. JMS..</li>
 </ul>
-<h2><a name="_Toc96698080"></a>Installation Guide </h2>
-<h3><a name="_Toc96698081"></a>Introduction </h3>
-<p>Axis 2.0 can be downloaded as a <a href="releases.html">zipped binary </a> or the <a href="cvs-usage.html">source </a>. This section describes how Axis2 can be installed either as a standalone server or as part of a J2EE compliant servlet container. </p>
-<h3><a name="_Toc96698082"></a>Prerequisites </h3>
-<p>Axis2 requires the Java Runtime Environment to be properly installed. Axis is developed to be run on JRE 1.4 and upwards but it has not been fully tested with the latest JRE 1.5. Hence it is safe to run Axis with Java 1.4. If the JRE is not already in place it must be installed to proceed further. For instructions on setting up the JRE in different operating systems, please visit <a href="http://java.sun.com/">http://java.sun.com </a>. </p>
-<p>All the required jars are shipped with the binary distribution and if the source distribution is used, running the maven build will automatically download the required jars for you. </p>
-<p>Following sections describe how each type of distribution needs to be installed. Since the process with the source distribution is similar to the binary distribution after building, the first section explains the process of building Axis from source. If you have the binary distribution you can skip the build sections and directly go to the binary installation section. </p>
-<h3><a name="_Toc96698083"></a>Building Axis2 from source </h3>
-<h4><a name="_Toc96698084"></a>Setting up the Environment and the tools </h4>
-<p>The Axis2 build is based on <a href="http://maven.apache.org/">Maven </a>. Hence the prerequisite to build Axis2 from source is to have Maven installed. Even though extensive instruction guides are available at the Maven site, this guide also contains the “easiest path” for quick environment setting. Advanced users who wish to know more about Maven can visit <a href="http://maven.apache.org/start/index.html">here </a>. </p>
-<p>For Windows users the easiest way is to download the windows installer package. Once the installer package is run, all the necessary environment variables will be properly set. Once Maven is installed, the success of the installation can be tested by typing “maven –version” in the command prompt. </p>
+<p align="center">&nbsp;</p>
 <p>&nbsp; </p>
-<p align="center"><img width="477" height="211" src="images/clip_image002.jpg"></p>
-<p>&nbsp; </p>
-<p>For Linux users the tar ball or the zip archive is the best options. (Unfortunately there is no rpm as such that can be easily installed) Once the archive is downloaded expand it to a directory of choice and set the environment variable “MAVEN_HOME” and add MAVEN_HOME/bin to the path as well. More instructions for installing Maven in UNIX based operating systems can be found <a href="http://maven.apache.org/start/install.html">here </a>. </p>
-<p>Once maven is properly installed it's all that is needed to start building Axis2. </p>
-<h4><a name="_Toc96698085"></a>The Axis source distribution </h4>
-<p>The <a href="releases.html">source distribution </a> is available as a zipped archive or a tar ball. All the necessary build scripts are included with the source distribution. Once the source archive is expanded into a directory of choice, moving to the particular directory and typing maven will build the axis jar file. </p>
-<p align="center"><img src="images/clip_image004.jpg" width="655" height="286"></p>
-<p>Once the command completes, the binaries (jar files in this case) can be found at a newly created “target\lib” directory. </p>
-<p><strong>Note – For the first Maven build (if the maven repository is not built first) it will take a while since required jars need to be downloaded. However this is a once only process and will not affect any successive builds. </strong></p>
-<p><strong> </strong>The default maven build will however build only the Axis2 jar file. To obtain a WAR (Web Archive), “maven war” command should be issued. This will create a complete WAR with the name axis2.war inside the target directory. </p>
-<p>Once this build step is complete, the binaries are ready to be deployed. </p>
-<h3><a name="_Toc96698086"></a>Installing Axis2 in a Servlet container </h3>
-<p>Installation of the WAR is quite simple. It's a matter of dropping the war in the webapps folders and most servlet containers will automatically install the war. However some servlet containers may require a restart in order to capture the new web application. Please refer your servlet container documentation for more information about this. </p>
-<p>Once the WAR is successfully installed it can be tested by pointing the web browser to the <strong>http:// &lt;host :port&gt;/ axis2. </strong>It should produce the following page. </p>
-<p align="center"><strong><img src="images/clip_image006.jpg"></strong></p>
-<p><strong>&nbsp; </strong>To ensure that everything is fine and smooth, a probing of the system can be done through the validate link. If the validation fails then the war has failed to install properly or some essential jars are missing. At such a situation the documentation of the particular servlet container should be consulted to find the problem. The following page is a successful validation. Note the statement “core axis libraries are present”. </p>
-<p align="center"><img src="images/clip_image008.jpg"></p>
-<p>The axis web application also provides an interface to upload services. Once a service is created according to the service specification (see the service jar file format structure) that jar file can be uploaded using the upload page. </p>
-<p align="center"><img src="images/clip_image010.jpg"></p>
-<p>&nbsp; </p>
-<p>The uploaded jar files will be stored in the default service directory. For Axis2 this will be the &lt;webapps&gt;/axis2/WEB-INF/services directory. Once a service is uploaded it will be instantly installed. </p>
-<p>Since Axis2 supports hot deployment one can drop the service jar directly through the file system to the above mentioned services directory and it will also cause the service to be automatically installed without the container being restarted. </p>
-<p>To check the successful installation of a service <strong><em>available services link </em></strong> is provided. The services and the operations of successfully installed services will be displayed in the available services page. </p>
-<p align="center"><img  src="images/clip_image012.jpg"></p>
+<p align="center">&nbsp;</p>
 <p>To test run an uploaded service, instructions are provided in the samples guide about running the sample clients. However whether the service is
 present can be checked by pointing the browser to <b>http://&lt;host&gt;:&lt;port&gt;/axis2/services/&lt;service name&gt;</b>.</p>
-<p>&nbsp;</p>
 <p>
   <!-- This should provide a page similar to the following -->
 </p>
@@ -145,27 +111,45 @@
  absolutely required and AXIS will not create it automatically in the case of the simple axis server. 
  </b></p> -->
 <h2><a name="_Toc96697863"></a>Samples</h2>
-<p>In this section of the userguide we will look at how to write and deploy Web Services and how to write Web Service Clients using Axis2. All the userguide samples are located at the <span class="style9">&quot;modules/samples&quot;</span> directory. So let's  explore the samples.</p>
-<p>Note: Please note that the rest of this userguide assumes that the user has downloaded the binary distribution of Axis2. If you have already downloaded the source tree of Axis2 then please create the binary distribution by simply using the maven command <strong>maven dist-bin </strong>This will create the &quot;axis2-M2-bin.zip&quot; and &quot;axis2-M2-bin.tar&quot;  in the &quot;target/dist&quot; directory. Extract the zip or the tar ball to any diretory in your machine and for the explantions purposes we will name this as &quot;Axis2Home&quot;. </p>
+<p>In this section of the user guide we will look at how to write and deploy Web Services and how to write Web Service Clients using Axis2. All the 
+user guide samples are located at the <b> <span class="style9">
+<font color="#000000">&quot;samples/userguide/src&quot;</font></span></b> directory 
+of the binary distribution. So.. let's  explore the samples.</p>
+<p>Note: Please note that the rest of this user guide assumes that the user has downloaded the binary distribution of Axis2. If you have already downloaded the source tree of Axis2 then please create the binary distribution by simply using the maven command <strong>maven dist-bin </strong>This will create the &quot;axis2-M2-bin.zip&quot; and &quot;axis2-M2-bin.tar&quot;  in the &quot;target/dist&quot; directory. Extract the zip or the tar ball to any 
+directory in your machine and for the explanations purposes we will name this as &quot;Axis2Home&quot;. </p>
 <h3> Web Services Using Axis2</h3>
-<p>Before starting, please check wither you have deployed the &quot;axis2.war&quot; in your servlet container and it is working properly.</p>
-<p>MyService</p>
+<p>Before starting, please check wither you have deployed the &quot;axis2.war&quot; in your servlet container and it is working properly.(See;
+<font color="#00FFFF">installation guide</font>)</p>
+<h4>MyService</h4>
 <p>First let's see how we can write a simple Web Service (MyService) and deploy it. For this purpose we will create a Web Service with two operations as follows.</p>
-<pre class="style1 style2 style3">public void ping(OMElement element){} //sample IN-ONLY operation, just accept the OMElement and do some processing.
-public OMElement echo(OMElement element){}//sample IN-OUT operation, accept an OMElement and respond with another OMElement after processing</pre>
-<p>You can find our first example Web Service(MyService) in the &quot;Axis2Home/samples/userguide/src&quot; directory under userguide/example1 package. As you can see, the two operations are very simple and need no explanations on what they are doing. So let's see how we can write the deployment descriptors for the service and deploy it.</p>
-<p>Axis2 uses &quot;service.xml&quot; to keep configurations for a Web Service. Each Web Service deployed under Axis2 needs a &quot;service.xml&quot; containing the configurations. &quot;service.xml&quot; for MyService will be as follows; we will see what each parameter means later.</p>
+<pre class="style1 style2 style3">public void ping(OMElement element){} //IN-ONLY operation, just accepts the OMElement and do some processing.
+public OMElement echo(OMElement element){}//IN-OUT operation, accepts an OMElement and responds with another OMElement after processing.</pre>
+<p>Complete code for this example Web Service (MyService) can be found in the &quot;Axis2Home/samples/userguide/src&quot; directory under 
+&quot;userguide/example1&quot; package. As you can see, the two operations are very simple and need no explanations on what they are doing. So let's see how we can write the deployment descriptors for the service and deploy it.</p>
+<p>Axis2 uses &quot;service.xml&quot; to keep configurations for a Web Service. Each Web Service deployed 
+in Axis2 needs a &quot;service.xml&quot; containing the configurations. &quot;service.xml&quot; for MyService will be as follows; we will see what each parameter means later.</p>
 <pre class="style1 style2 style3">&lt;service name=&quot;MyService&quot;&gt;<br>    &lt;description&gt;<br>        This is a sample Web Service with two operations,echo and ping.<br>    &lt;/description&gt;<br>    &lt;parameter name=&quot;ServiceClass&quot; locked=&quot;xsd:false&quot;&gt;userguide.example1.MyService&lt;/parameter&gt;<br>    &lt;operation name=&quot;echo&quot;&gt;<br>        &lt;messageReceiver class=&quot;org.apache.axis.receivers.RawXMLINOutMessageRecevier&quot;/&gt;<br>    &lt;/operation&gt;<br>     &lt;operation name=&quot;ping&quot;&gt;<br>        &lt;messageReceiver class=&quot;org.apache.axis.receivers.RawXMLINOnlyMessageRecevier&quot;/&gt;<br>    &lt;/operation&gt;<br> &lt;/service&gt;</pre>
-<p>As it can be seen, first line of the &quot;service.xml&quot; gives the name of the Web Service. This is used in the URL to the service as the service name. Next comes the description and the service class. The next two xml tags describe the operations that are available in this service with respective message receivers. For the &quot;echo&quot; operation we have used a <strong>RawXMLINOutMessageRecevier</strong> since it is an InOut operation. For one way operation, &quot;ping&quot; we have used <strong>RawXMLINOnlyMessageRecevier</strong> as the message receiver. </p>
-<p>Axis2 use &quot;.aar&quot; file as the deployemnt package for Web Services. So for the MyService we will use &quot;MyService.aar&quot; with the &quot;service.xml&quot; packaged under META-INF as shown in the following picture.</p>
+<p>As it can be seen, first line of the &quot;service.xml&quot; gives the name of the Web Service. This is used in the URL to the service as the service name. Next comes the description and the service class. The next two xml tags describe the operations that are available in this service with respective message receivers. For the &quot;echo&quot; operation we have used a <strong>RawXMLINOutMessageRecevier</strong> since it is an 
+IN-OUT operation. For IN-ONLY operation, &quot;ping&quot; we have used <strong>RawXMLINOnlyMessageRecevier</strong> as the message receiver. </p>
+<p>Axis2 use &quot;.aar&quot; (Axis Archive) file as the deployment package for Web Services. So, 
+for MyService we will use &quot;MyService.aar&quot; with the &quot;service.xml&quot; packaged 
+in the META-INF as shown in the following picture.</p>
 <p><img src="images/userguide/ServiceItems.JPG" width="176" height="91"></p>
-<p>To create  &quot;MyService.aar&quot;  user can first create a jar file containing all the files necessary for the service and then rename the &quot;jar&quot; to &quot;aar&quot; so that Axis2 understands it as a service archive. For this explanation we can use the &quot;MyService.aar&quot; that is in  the Axis2Home/samples/userguide directory. </p>
-<p>Since this is our firts service we need once more steps before we depoly the service. That is to create a directory named &quot;services&quot; under &quot;webapps/axis2/WEB-INF&quot; of you servlet container. Deploying is just a matter of droping the &quot;.aar&quot; in to this drectory and hence please copy the &quot;MyService.aar&quot; into the service directory. Once these steps are completed, please start the servlet container (if you have not already started) and check the link &quot;List Available services&quot; in the page http://localhost:8080/axis2/index.jsp and see whether the MyService is deployed properly. If eveyting is ok, you will see the following out put.. </p>
+<p>To create  &quot;MyService.aar&quot;  user can first create a jar file containing all the files necessary for the service and then rename the &quot;jar&quot; to &quot;aar&quot; so that Axis2 understands it as a service archive. 
+This has already been created in the &quot;Axis2Home/samples/userguide&quot; directory, 
+and let's use it.. </p>
+<p>Since this is our first Web Service&nbsp; we need one more step before we 
+deploy the service. That is to create a directory named &quot;<b>services</b>&quot; under &quot;webapps/axis2/WEB-INF&quot; of you servlet container. Deploying is just a matter of 
+dropping the &quot;.aar&quot; in to this directory and hence please copy the &quot;MyService.aar&quot; into the 
+&quot;<b>services</b>&quot; directory. Once these steps are completed, please start the servlet container (if you have not already started) and check the link &quot;List Available services&quot; in the page http://localhost:8080/axis2/index.jsp and see whether the MyService is deployed properly. If 
+everything is ok, you will see the following out put.. </p>
 <p align="center"><img src="images/userguide/MyServiceDeployed.JPG" width="797" height="654"> </p>
-<p>If you can see the above out put then you have successfully deployed MyService on Axis2. Now let's see how we can write Web Service client to use this services.</p>
+<p>If you can see the above out put then you have successfully deployed MyService on Axis2. Now let's see how we can write Web Service client to use this services. 
+Axis2 provides an easy way to deploy a Web Services using, index.jsp. (See the 
+installation guide for more information on this)</p>
 <h3> Web Service Clients Using Axis2 </h3>
 <h4>EchoBlockingClient</h4>
-<p>Axis2 provides the user with various invocation patterns for Web Services, ranging from pure blocking single channel invocations to a non blocking dual channel invocations. First let's see how we can write a client to invoke &quot;echo&quot; operation of &quot;MyService&quot; using the simplest good old blocking invocation. The client code that you need to write will be as follows.</p>
+<p>Axis2 provides the user with several invocation patterns for Web Services, ranging from pure blocking single channel invocations to a non-blocking dual channel invocations. First let's see how we can write a client to invoke &quot;echo&quot; operation of &quot;MyService&quot; using the simplest good old blocking invocation. The client code that you need to write will be as follows.</p>
 <pre class="style1 style2 style3">  try {
             OMElement payload = ClientUtil.getEchoOMElement();
             <span class="style10">Call call = new Call();
@@ -187,14 +171,16 @@
         }
 }
 </pre></p>
-<p>The green lines shows the set of operations that you need to perform in-order to invoke a web service while the rest is used to create the OMElement that needs to be sent and to display the response OMElement. To test this clent you can use the &quot;TestEchoBlockingClient.bat&quot; that can be found in the &quot;Axis2Home/samples/userguide/src/userguide/clients/bin&quot; directory. The bat or .sh files show the required jars for one to write Web Service clients using Axis2. So if you can see the response OMElement printed in your command line (as shown below)  then you have successfully tested the client as well. </p>
+<p>The green lines shows the set of operations that you need to perform in-order to invoke a web service while the rest is used to create the OMElement that needs to be sent and to display the response OMElement. To test this 
+client you can use the &quot;TestEchoBlockingClient.bat&quot; that can be found in the &quot;Axis2Home/samples/userguide/src/userguide/clients/bin&quot; directory. The 
+.bat or .sh files show the required jars that needs to be there in the classpath for one to write Web Service clients using Axis2. So if you can see the response OMElement printed in your command line (as shown below)  then you have successfully tested the client as well. </p>
 <p><img src="images/userguide/TestClient.JPG" width="951" height="132"></p>
 <h4>PingClient</h4>
-<p>In the Web Service &quot;MyService&quot; we had a IN-ONLY operation with the name &quot;ping&quot; (see Web Services Using Axis2). So let's write a client to invoke this operation as well. As earlier the client code will be as follows.</p>
+<p>In the Web Service &quot;MyService&quot; we had a IN-ONLY operation with the name &quot;ping&quot; (see Web Services Using Axis2). So let's write a client to invoke this operation as well. 
+The client code will be as follows.</p>
 <pre class="style1 style2 style3"> try {
        OMElement payload = ClientUtil.getPingOMElement();
 
-
        MessageSender msgSender = new MessageSender();
        msgSender.setTo(targetEPR);
        msgSender.setSenderTransport(Constants.TRANSPORT_HTTP);
@@ -205,24 +191,43 @@
      }
 </pre>
 </p> 
-<p>Since we are accessing a one way operation we can directly use the &quot;MessageSender&quot; to invoke this operation. As it can be seen in the above code , it is very straight forward to invoke this type of operation. MessageSender will not block the invockation, hence it will return the control immediately back to the client. You can find the &quot;TestPingClient.bat&quot; in the &quot;Axis2Home/samples/userguide/src/userguide/clients/bin&quot; directory and give it a try.</p>
-<p>Ok, we have invoked the two operations in our service, Are we done? No!, there are lot more to explore, Let's see some other ways to invoke same operations.</p>
+<p>Since we are accessing a IN-ONLY operation we can directly use the &quot;MessageSender&quot; to invoke this operation. As it can be seen in the above code , it is very straight forward to invoke this type of operation. MessageSender will not block the 
+invocation, hence it will return the control immediately back to the client. You can 
+test this client using the &quot;TestPingClient.bat&quot; that is in &quot;Axis2Home/samples/userguide/src/userguide/clients/bin&quot;.</p>
+<p>Ok, we have invoked the two operations in our service, Are we done? No!, there are lot more to explore, Let's see some other ways to invoke 
+the same operations.</p>
 <h4>EchoNonBlockingClient</h4>
-<p>In the EchoBlockingClient once the &quot;call.invokeBlocking("echo", payload);&quot; is called, the client is blocked till the operation is completed. This behavior is not desireable when there are many Web Service invocations to be done in a single client application. A solution, would be to use a Non-Blocking API to invoke web services. Axis2 provides a callback based non-blocking API for users. </p>
+<p>In the EchoBlockingClient once the &quot;call.invokeBlocking("echo", payload);&quot; is called, the client is blocked till the operation is completed. This behavior is not 
+desirable when there are many Web Service invocations to be done in a single client application. A solution, would be to use a Non-Blocking API to invoke web services. Axis2 provides a callback based non-blocking API for users. </p>
 <p>A sample client for this can be found under &quot;Axis2Home/samples/userguide/src/userguide/clients&quot; with the name EchoNonBlockingClient. If we consider the changes that the user may have to do with respect to the &quot;EchoBlockingClient&quot; that we have already seen, it will be as follows.</p>
 <pre class="style1 style2 style3">call.invokeNonBlocking(&quot;echo&quot;, payload, callback);</pre>
-<p>The invocaton  accepts a callback object as a parameter. Axis2 client API provides an abastract Callback with the following methods.</p>
+<p>The invocation  accepts a callback object as a parameter. Axis2 client API provides an 
+abstract Callback with the following methods.</p>
 <p><pre class="style1 style2 style3">public abstract void onComplete(AsyncResult result);
 public abstract void reportError(Exception e);
 public boolean isComplete() {}</pre></p>
-<p>The user is expected to implement the &quot;onComplete &quot; and &quot;reportError &quot; methods of their extended call back class. Axis2 engine calls the onComplete method once the Web Service respones is received by the Axis2 Client API (Call). This will elimenate the blocking nature of the Web Service invocations and provides the user with the flexibility to use Non Blocking API for Web Service Cleints.</p>
+<p>The user is expected to implement the &quot;onComplete &quot; and &quot;reportError &quot; methods of their extended call back class. Axis2 engine calls the onComplete method once the Web Service 
+response is received by the Axis2 Client API (Call). This will eliminate the blocking nature of the Web Service invocations and provides the user with the flexibility to use Non Blocking API for Web Service 
+Clients.</p>
 <p>To run the sample client ( EchoNonBlockingClient) you can simply use the &quot;TestEchoNonBlockingClient.bat&quot; or &quot;TestEchoNonBlockingClient.sh&quot; files that can be found in the &quot;Axis2Home/samples/userguide/src/userguide/clients/bin&quot; directory. </p>
 <h4>EchoNonBlockingDualClient </h4>
-<p>The solution provided by the Non-Blocking API, for the Web Service invocations which takes long time to complete, has one limitation. That is limitation due to the use of single transport connection to invoke the Web Service and to retrieve the response. In otherwords, client API provides a non blocking invocation mechanism for the users, but the request and the response comes in a single  transport connection (needs two way transport like HTTP). Long runnig Web Service invocations or Web Service invocations using One-Way transports (like SMTP) cannot be utilized by simply using a non blocking invocation. </p>
-<p>The trivial solution is to use separate transport connections (either One-Way or Two-Way) for the request and response. The next problem that needs to be sloved is the correlation (correlating the request and the response). WS-Addressing provides a neat solution to above using &lt;wsa:MessageID&gt; and &lt;wsa:RelatesTo&gt; headers. Axis2 provides support for  addressing based correlation mechanism and a complying Client API to invoke Web Services with two transport connections. </p>
-<p>Users can select between Blocking or Non-Blocking APIs for the Web Service client. By simply using a boolean flag, this same API can be used to invoke web services(IN-OUT operations) using two separate transport connections. Let's see how we can do it using an example. Following code fragement shows how to invoket the same &quot;echo&quot; operation, using Non-Blocking API with two transport connections<strong>.The ultimate asynchronoy!!</strong></p>
-<pre class="style1 style2 style3">
-  try {
+<p>The solution provided by the Non-Blocking API has one limitation when it 
+comes to&nbsp; Web Service invocations which takes long time to complete. The limitation 
+is due to the use of single transport connection to invoke the Web Service and to retrieve the response. In 
+other words, client API provides a non blocking invocation mechanism for the users, but the request and the response comes in a single  transport connection (needs two way transports like HTTP). Long 
+running Web Service invocations or Web Service invocations using One-Way transports (like SMTP) cannot be utilized by simply using a non blocking invocation. </p>
+<p>The trivial solution is to use separate transport connections (either One-Way or Two-Way) for the request and response. The next problem that needs to be 
+solved is the correlation (correlating the request and the response). 
+<a href="http://www.w3.org/Submission/ws-addressing/">WS-Addressing</a> provides a neat solution to above using &lt;wsa:MessageID&gt; and &lt;wsa:RelatesTo&gt; headers. Axis2 provides support for  addressing&nbsp; based correlation mechanism and a complying Client API to invoke Web Services with two transport connections. 
+(core of Axis2 does not depend on WS-Addressing, and it is the addressing like 
+properties, hence Axis2 has the flexibility to use different versions of 
+addressing)</p>
+<p>Users can select between Blocking or Non-Blocking APIs for the Web Service clients 
+with two transport connections. By simply using a boolean flag, the same API can be used to invoke web 
+services (IN-OUT operations) using two separate transport connections. Let's see how we can do it using an example. Following code 
+fragment shows how to invoke the same &quot;echo&quot; operation, using Non-Blocking API with two transport 
+connections<strong>. The ultimate asynchrony!!</strong></p>
+<pre class="style1 style2 style3">  try {
             OMElement payload = ClientUtil.getEchoOMElement();
 
             Call call = new Call();
@@ -230,7 +235,7 @@
 
             //The boolean flag informs the axis2 engine to use two separate transport connection
             //to retrieve the response.
-            <span class="style13">call.engageModule(new QName("addressing"));</span>
+            <font color="#33CC00">call.engageModule(new QName(Constants.MODULE_ADDRESSING));</font>
             call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, <span class="style13">true</span>);
 
             //Callback to handle the response
@@ -260,7 +265,8 @@
             //Wait till the callback receives the response.
             while (!callback.isComplete()) {
                 Thread.sleep(1000);
-            }
+            }</pre>
+<pre class="style1 style2 style3">	  <font color="#33CC00">call.close();</font>
 
         } catch (AxisFault axisFault) {
             axisFault.printStackTrace();
@@ -268,369 +274,41 @@
             ex.printStackTrace();
         }
 </pre>
-<p>The two changes that we need at the client side are shown in the &quot;green&quot; color. Since our correlation mechanism is based on addressing we need to first &quot;<strong>engage</strong>&quot; the addressing module.<span class="style15"> Inorder to do that ... </span></p>
-<p>Before we run the sample cleint we need one more step to perform. As mentioned earlier Axis2 uses addressing based correlation mechanim and hence we need to &quot;engage&quot; addressing moduel in the server side as well. According to the Axis2 architecture addressing module is deployed in the &quot;<strong>pre-dispatch</strong>&quot; pahse and hance &quot;engaging&quot; means simply adding module reference in the &quot;server.xml&quot; (NOT the &quot;service.xml&quot;). Please add the following line to the &quot;server.xml&quot; that you can find in the &quot;/webapps/axis2WEB-INF&quot; directory under servlet container.</p>
+<p>The three changes that we need do to the EchoNonBlockingClient are shown in the &quot;green&quot; color. Since our correlation mechanism is based on addressing we need 
+to first &quot;<strong>engage</strong>&quot; the addressing module.<span class="style15">
+<font color="#000000"><b>&quot;call.engageModule(new 
+QName(Constants.MODULE_ADDRESSING));&quot; </b>informs the Axis2 engine to engage the 
+addressing module at the client side. The boolean flag (value true) in the &quot;<br>
+<b>call.setTransportInfo(...)</b>&quot; method informs the Axis2 engine to use 
+separate transport connections for request and response. Finally &quot;<b>call.close()</b>&quot; 
+informs the Axis2 engine to stop the client side listener started to retrieve 
+the response.</font></span></p>
+<p>Before we run the sample client we need one more step to perform. As mentioned earlier Axis2 uses addressing based correlation 
+mechanism and hence we need to &quot;engage&quot; addressing module in the server side as well. According to the Axis2 architecture addressing module is deployed in the &quot;<strong>pre-dispatch</strong>&quot; 
+phase (See <a href="Axis2ArchitectureGuide.html">Architecture Guide</a> for more 
+details about phases)&nbsp; and hence &quot;engaging&quot; means simply adding module reference in the &quot;server.xml&quot; (NOT the &quot;service.xml&quot;). Please add the following line to the &quot;server.xml&quot; that you can find in the &quot;/webapps/axis2/WEB-INF&quot; 
+directory in the servlet container. </p>
 <pre class="style1 style2 style3"> &lt;module ref=&quot;addressing&quot;/&gt;</pre>
-<p>This will enable the addressing in the server side and now you can test the &quot;TestEchoNonBlockingDualClient&quot; using the &quot;TestEchoNonBlockingDualClient.bat&quot; or &quot;TestEchoNonBlockingDualClient.sh&quot; provided under &quot;Axis2Home/samples/userguide/src/userguide/clients/bin&quot; directory.</p>
-<p>Note: Please note th<span class="style15">at once you change the &quot;server.xml&quot; you need to restart the servelet container and make sure that marr </span></p>
-<p>&nbsp;</p>
-<p>MyService with a Logging Module 
-</p>
+<p>Note: Please note that<span class="style15"><font color="#000000"> once you change the &quot;server.xml&quot; you need to restart the servlet container.</font></span></p>
+<p>This will enable the addressing in the server side and now you can test the &quot;TestEchoNonBlockingDualClient&quot; using the &quot;TestEchoNonBlockingDualClient.bat&quot; or &quot;TestEchoNonBlockingDualClient.sh&quot; provided under &quot;Axis2Home/samples/userguide/src/userguide/clients/bin&quot; directory. 
+If you can see the response OMElement printed in the client side, that means you 
+have successfully tested the Non Blocking API with two transport channels at the 
+client side.</p>
+<h4>EchoBlockingDualClient </h4>
+<p>This is again a two transport request/response client, but this time, we use 
+a Blocking API in the client code. Sample code for this can be found in the 
+&quot;Axis2Home/samples/userguide/src/userguide/clients/&quot; directory and the 
+explanation is similar to the EchoNonBlockingDualClient, except that here we do 
+not use a callback object to handle response. This is a very useful mechanism 
+when the service invocation is IN-OUT in nature and the transports are One-Way 
+(e.g. SMTP). For the sample client we use two HTTP connections for request and 
+response.</p>
+<h3>&nbsp;</h3>
+<h3>Modules</h3>
+<h4>MyService with a Logging Module 
+</h4>
 <h3>&nbsp;</h3>
 <h3>Other Samples //Links to Google Samples </h3>
-<h2> Modules</h2>
 <h2>Tools</h2>
-<p>&nbsp;</p>
-<p>&nbsp; </p>
-<p>There are three sample programs, which are listed below, that will be explained in this user guide and the relevant code can be found in the source directory under ../modules/samples/src/java/userguide/sample1. </p>
-<ol>
-  <li>Case1: Echo Synchronous call. </li>
-  <li>Case2: Echo Synchronous call with a phased handler. </li>
-  <li>Case3: Echo Asynchronous call at the client side.  </li>
-</ol>
-<p>For the above three cases the sample will make use of two web services(namely sample1, sample1WithHandler) and two client applications. The diagram shows how the two services and the two client applications are used to come up with the three cases mentioned above.</p>
-<p align="center"><img src="images/cases.jpg" width="467" height="246"></p>
-
-<p> Axis2 M1 currently does not support the data binding, thus in the samples the operation that will be supported will be the echoing of xml without data binding. The message that will be sent and echoed will be the following.</p>
-<pre class="style1 style2 style3">&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sample1="http://sample1.org/sample1"&gt;
- &nbsp;&nbsp;&nbsp;&nbsp; &lt;soapenv:Header/&gt;
- &nbsp;&nbsp;&nbsp;&nbsp; &lt;soapenv:Body&gt;
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sample1:echo&gt;
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sample1:Text&gt;Axis2   Echo String&lt;/sample1:Text&gt; &nbsp;
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/sample1:echo&gt;
- &nbsp;&nbsp;&nbsp; &lt;/soapenv:Body&gt;
- &lt;/soapenv:Envelope&gt;
- </pre>
-<p>The Sample1 can be located at the src/samples/userguide/sample1 directory and it will have (or eventually have after the build) the following files. </p>
-<p>&nbsp;</p>
-<table width="756" align="center" border="1"  cellpadding="0" cellspacing="0">
-  <tr>
-    <td width="138" align="center" valign="top"><p align="center">Directory </p></td>
-    <td width="245" valign="top"><p align="center">File </p></td>
-    <td width="371" valign="top"><p align="center">Description </p></td>
-  </tr>
-  <tr>
-    <td valign="top"><p>modules/samples</p></td>
-    <td valign="top"><p>build.xml </p></td>
-    <td valign="top"><p>Ant build file to compile, deploy and run the sample </p></td>
-  </tr>
-  <tr>
-    <td valign="top"><p>modules/samples/src </p></td>
-    <td valign="top"><p>EchoXML.java </p></td>
-    <td valign="top"><p>Actual web service </p></td>
-  </tr>
-  <tr>
-    <td colspan="3" valign="top"><p>&nbsp; </p></td>
-  </tr>
-  <tr>
-    <td valign="top"><p>&nbsp; </p></td>
-    <td valign="top"><p>SynchronousClient.java </p></td>
-    <td valign="top"><p>Echo Synchronous client. The same client will be used for Echo Synchronous call with a phased handler. </p>
-        <p>&nbsp; </p></td>
-  </tr>
-  <tr>
-    <td colspan="3" valign="top"><p>&nbsp; </p></td>
-  </tr>
-  <tr>
-    <td valign="top"><p>&nbsp; </p></td>
-    <td valign="top"><p>LoggingHandler.java </p></td>
-    <td valign="top"><p>A handler that will log when it gets called. </p></td>
-  </tr>
-  <tr>
-    <td colspan="3" valign="top"><p>&nbsp; </p></td>
-  </tr>
-  <tr>
-    <td valign="top"><p>&nbsp; </p></td>
-    <td valign="top"><p>AsynchronousClient.java </p></td>
-    <td valign="top"><p>Echo client with client side Asynchronous call </p></td>
-  </tr>
-  <tr>
-    <td valign="top"><p>&nbsp; </p></td>
-    <td valign="top"><p>ClientEchoCallbackHandler.java </p></td>
-    <td valign="top"><p>The callback that will be called after the completion of the Asynchronous call. </p></td>
-  </tr>
-  <tr>
-    <td valign="top"><p>&nbsp; </p></td>
-    <td valign="top"><p>ClientUtil.java </p></td>
-    <td valign="top"><p>A client Utility class that will generate a SOAPEnvelope.</p></td>
-  </tr>
-  <tr>
-    <td colspan="3" valign="top"><p>&nbsp; </p></td>
-  </tr>
-  <tr>
-    <td valign="top"><p>modules/samples/conf </p></td>
-    <td valign="top"><p>service.xml </p></td>
-    <td valign="top"><p>The deployment descriptor for the service sample1. </p></td>
-  </tr>
-   <tr>
-    <td valign="top"></td>
-    <td valign="top"><p>service4withhandler.xml </p></td>
-    <td valign="top"><p>The deployment descriptor for the service sample1WithHandler. </p></td>
-  </tr>
-  <tr>
-    <td valign="top"><p>modules/samples/</p>
-      <p>build/services </p></td>
-    <td valign="top"><p>sample1.jar </p></td>
-    <td valign="top"><p>The deployable jar that is created after building the sample. </p></td>
-  </tr>
-  <tr>
-    <td valign="top"></td>
-    <td valign="top"><p>sample1WithHandler.jar </p></td>
-    <td valign="top"><p>The deployable jar of the web service sample1WithHandler that is created after building this sample.</p></td>
-  </tr>
-  <tr>
-    <td valign="top"><p>modules/samples/</p>
-      <p>build/lib </p>
-    </td>
-    <td valign="top"><p>sample1-all.jar </p></td>
-    <td valign="top"><p>The jar that bundles the server side and client side code. </p></td>
-  </tr>
-</table>
-<h3><a name="_Toc96698089"></a>Pre-Conditions </h3>
-<p>Axis2 should be installed (see the Installation guide above). For simplicity samples will assume the servlet container is Tomcat. </p>
-<p>AXIS_HOME environment variable be set. (Rationale: The compile time and runtime libraries required in the classpath for the samples will be picked up form the deployed Asix2.) </p>
-<p align="center"><img width="384" height="430" src="images/clip_image014.jpg"></p>
-<p>Apache Ant should be installed and should be available in the path. It can be checked whether Ant is properly installed by simply typing ant in the command prompt. Please refer<a href="http://ant.apache.org/"> http://ant.apache.org/</a>.</p>
-<p align="center"><img src="images/ant.jpg" width="648" height="130"></p>
-<h2>Building the sample</h2>
-<p>The sources that are required for the running the samples can be compiled and packaged using the following ant task provided in the build.xml. Thus to build the samples the user can open a command prompt and change directory to modules\samples where the build.aml is located and type </p>
-<p>>ant compile</p>
-<p>or simply</p>
-<p>>ant</p>
-<p align="center"><img src="images/clip_image018.jpg" width="575" height="296"></img></p>
-<p>The compilation will result in building three jar files; two of which are deployable services and the other is the compiled classes required for running the samples.</p>
-<ul>
-	<li>sample1.jar – Deployable web service that will be used for Case1 and Case3 (Packaged to modules/samples/build/services)</li>
-	<li>sample1Withhandler.jar – Deployable web service that will be used for Case2 (Packaged to modules/samples/build/services)</li>
-	<li>sample1-all.jar – Compiled sources required for running the client applications (Packaged to modules/samples/build/lib)</li>
-</ul>
-<p>Once the sample is compiled once, all the required jar files for deploying and running all three Cases of the sample will be compiled and packaged.</p>
-<h3><a name="_Toc96698091"></a>Sample1- Case1 : Echo Synchronous call </h3>
-<p>The sample1 - Case1: Echo synchronous call is intended to demonstrate the synchronous web service call in Axis2 with both the client side and server side running Axis2. In the next few steps the user will be walked through in: </p>
-<ul>
-  <li>Compiling and building a web service </li>
-  <li>Deploying </li>
-  <li>Running the client  </li>
-</ul>
-
-<p>It is assumed that the sample is already compiled. Please refer "Building Sample1" above.</p>
-
-
-<h4><strong>Deploying the sample </strong></h4>
-<p>Before deploying the sample, it is necessary to package the web service. The actual web service implementation is the EchoXML.java and it is necessary to write a service.xml so that the necessary statistics about the service will be available to the Axis2 engine at the runtime. </p>
-<pre class="style1 style2 style3">&lt;service provider=&quot;org.apache.axis.providers.RawXMLProvider&quot; style=&quot;rpc&quot;&gt; 
-   &nbsp;&nbsp;&lt;java:implementation class=&quot;userguide.sample1.EchoXML&quot; xmlns:java=&quot;http://ws.apache.org/axis2/deployment/java&quot;/&gt;
-&nbsp;&nbsp;&lt;operation name=&quot;echo&quot; qname=&quot;echo&quot;/&gt;   
-&lt;/service&gt; </pre>
-<p>Above service.xml provides five required types of information. </p>
-<ul>
-  <li>Provider – Provider that will invoke the service. </li>
-  <li>Style - Style of the operations of the service. </li>
-  <li>Implementation – Actual web service implementation class, in this case EchoXML. </li>
-  <li>Operation – The operations that the web service implementation supports or needs to be exposed. </li>
-</ul>
-<p>Once the service.xml and the web service (in this case EchoXML) is ready it is necessary to package it to a jar. Actually with the above </p>
-<p>&gt;ant compile </p>
-<p>The web service will get packaged into the build\services directory. Now the user can deploy the service by one of the following methods. Since Axis2 supports the hot deployment of services can be deployed while the container is up and running. For option 2 below actually requires the container to be online. </p>
-<p>&gt;ant deploy </p>
-<p align="center"><img src="images/clip_image018.jpg" width="575" height="296"></p>
-<p>&nbsp; </p>
-<p>&#149;&nbsp; Uploading the jar using the web interface provided in the <strong>http:// &lt;host :port&gt;/ axis2 </strong>location. Please refer the Installation guide for further information. </p>
-<p>&#149;&nbsp; Manually copying the sample1.jar in build\services to the AXIS_HOME\WEB-INF\services directory. </p>
-<p><strong>The service will be deployed with the packaged jar file name. If the jar file is sample1.jar the service will be deployed with the name “sample1”. </strong></p>
-<p>Point to note here is that above ant task is going to deploy two services </p>
-<ol>
-  <li>sample1 – Required for this(Case1) and the EchoAsync Call examples(Case1 and Case3). </li>
-  <li>sample1WithHandler – required for Echo Synchronous call with a phased handler(Case2). </li>
-</ol>
-<p>If the servlet container is now running the user can go check to see whether the above services are deployed. Please refer the installation guide for further information on checking the deployed services. </p>
-<p align="center"><img width="647" height="434" src="images/clip_image020.jpg"></p>
-<h4><strong>Running the sample </strong></h4>
-<p>The sample provides a simple synchronous client in the SynchronousClient.java class. First the user must start the servlet container and run the client by simply typing </p>
-<p>&gt;ant echo </p>
-<p>in the command prompt. If all goes well the user will get the following output where the program will print the request SOAP message and the response SOAP message, which will be same as the request message. </p>
-<p align="center"><img width="648" height="269" src="images/clip_image022.jpg"></p>
-<h3><a name="_Toc96698092"></a>Sample1 - Case2: Echo Synchronous call with a phased handler. </h3>
-<p>This example will go one step forward from the example above and will deploy a web service with a Logging handler. The client application will not change, of course with an exception; the Endpoint Reference will be changed to refer the new service <strong>“Sample1WithHandler” </strong>. </p>
-<p>There is a Handler (LoggingHandler.java) that is introduced in this case and it will basically log the fact that it got called. The code can be found in LoggingHandler.java. </p>
-<pre class="style1 style2 style3">public void invoke(MessageContext msgContext) throws AxisFault { 
-&nbsp;&nbsp;log.info(&quot;Incoming message From &quot;+msgContext.getTo().getAddress());   
-
-public void revoke(MessageContext msgContext){  
-&nbsp;&nbsp;log.info(&quot;Incoming message Revoked at the server &quot;+msgContext.getTo().getAddress() );  
-} </pre>
-<p>It is assumed that the sample is compiled. Please refer "Building Sample" above.</p>
-<h4><strong>Deploying the sample </strong></h4>
-<p>The implementation of the web service will be EchoXML, operation will be echo and the provider will be org.apache.axis.providers.RawXMLProvider, which are similar to that of the <strong>“Echo Synchronous call” </strong>. The difference is that there will be a handler that will be added in the server side. For further discussion refer the following service.xml which will be used in deploying the service. </p>
-<pre class="style1 style2 style3">&lt;service provider=&quot;org.apache.axis.providers.RawXMLProvider&quot; style=&quot;rpc&quot;&gt; 
- &nbsp;&lt;java:implementation class=&quot;userguide.sample1.EchoXML&quot; xmlns:java=&quot;http://ws.apache.org/axis2/deployment/java&quot;/&gt; &nbsp;&nbsp; </pre><pre class="style1 style2 style3">&nbsp;&nbsp;&lt;inflow&gt;    
- &nbsp;&nbsp;&nbsp;&nbsp;&lt;handler name=&quot;LoggingHandler&quot; class=&quot;userguide.sample1.LoggingHandler&quot;&gt;  
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;order phase=&quot;Logging&quot;/&gt;  
- &nbsp;&nbsp;&nbsp;&nbsp;&lt;/handler&gt;  
- &nbsp;&nbsp;&lt;/inflow&gt;  
- 
- &nbsp;&nbsp;&lt;outflow&gt;  
- &nbsp;&nbsp;&lt;/outflow&gt;  
- 
- &nbsp;&nbsp;&lt;faultflow&gt;  
- &nbsp;&nbsp;&nbsp;&nbsp;&lt;handler name=&quot;LoggingHandler&quot; class=&quot;userguide.sample1.LoggingHandler&quot;&gt;  
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;order phase=&quot;Logging&quot;/&gt; 
- &nbsp;&nbsp;&nbsp;&nbsp;&lt;/handler&gt;  
- &nbsp;&nbsp;&lt;/faultflow&gt;  
- 
- &nbsp;&nbsp;&lt;operation name=&quot;echo&quot; qname=&quot;echo&quot;/&gt;  
- &lt;/service&gt; </pre>
-<p>In extra this service.xml has defined three elements </p>
-<ol>
-  <li>inflow </li>
-  <li>outflow </li>
-  <li>faultflow </li>
-</ol>
-<p>These refer to the flows of the Axis2 server and further information of each could be found in the Architecture Guide. Using these elements the deployer can specify what handlers should go into which each flow. It can be further explained by referring to the entries in the above service.xml. In the above descriptor for the inflow and the faultfow there is a handler element that is added. At the deployment time, Axis2 will incorporate that handler to both the inflow and the fault flow. Since there is no such entry for the outflow no handler will be associated with the outflow. </p>
-<p>Handler should specify the implementation class and the phase that it belongs to. In this case the handler belong to the <strong>Logging </strong> phase and this phase name should be one of that is defined in the <strong>server.xml </strong>(not service.xml). So this <strong>Logging </strong> phase should be defined there in the server.xml which is located in AXIS_HOME/ axis2/WEB-INF. The following is the default server.xml that is shipped with axis2.war. </p>
-<pre class="style1 style9  style2 style3">&lt;server name=&quot;AxisJava2.0&quot;&gt;   
-   &nbsp;&nbsp;&lt;parameter name=&quot;hotdeployment&quot; locked=&quot;xsd:false&quot;&gt;true&lt;/parameter&gt;    
-   &nbsp;&nbsp;&lt;parameter name=&quot;hotupdate&quot; locked=&quot;xsd:false&quot;&gt;true&lt;/parameter&gt;    
-   &nbsp;&nbsp;&lt;transports&gt;    
-   &nbsp;&nbsp;&nbsp;&nbsp;&lt;transport name=&quot;http&quot;/&gt;    
-   &nbsp;&nbsp;&nbsp;&nbsp;&lt;transport name=&quot;smtp&quot;/&gt;    
-   &nbsp;&nbsp;&lt;/transports&gt;    
-   &nbsp;&nbsp;&lt;phaseOrder&gt;    
-   &nbsp;&nbsp;&nbsp;&nbsp;&lt;phase name=&quot;global&quot;/&gt;    
-   &nbsp;&nbsp;&nbsp;&nbsp;&lt;phase name=&quot;transport&quot;/&gt;    
-   &nbsp;&nbsp;&nbsp;&nbsp;&lt;phase name=&quot;Logging&quot;/&gt;    
-   &nbsp;&nbsp;&nbsp;&nbsp;&lt;phase name=&quot;module&quot;/&gt;    
-   &nbsp;&nbsp;&nbsp;&nbsp;&lt;phase name=&quot;service&quot;/&gt;    
-   &nbsp;&nbsp;&lt;/phaseOrder&gt;    
- &lt;/server&gt;  </pre>
-<p>Since the Logging phase is there in the default server.xml the user who runs these samples need not edit the server.xml at all. </p>
-<p>Nevertheless deploying the sample is very easy and it can be done in any of the three methods described in the <strong>“Echo Synchronous call” </strong> case. Infact had the use typed </p>
-<p>&gt;ant deploy </p>
-<p>and deployed the service in the <strong>“Echo Synchronous call” </strong> case then this service too will be deployed. The relevant jar file is <strong>sample1WithHandler.jar </strong> and will be packed to \build\services directory if the user wants to deploy it manually or upload using the web application. </p>
-<h4><strong>Running the sample </strong></h4>
-<p>In this case the client side is similar to that of <strong>“Echo Synchronous call” </strong>. The changes are happening in the server side in this case. The same SynchronousClient.java can be used to invoke the service by changing the command line arguments. Refer the ant target for details </p>
-<pre class="style4">&lt;target name= &quot;echo&quot; depends= &quot;compile&quot; &gt;  
- &nbsp;&nbsp;&lt;java classname= &quot;userguide.sample1.SynchronousClient&quot;&gt; 
-&nbsp;&nbsp;&nbsp;&nbsp;&lt;classpath refid= &quot;classpath.runtimelibraries&quot; /&gt;  
-&nbsp;&nbsp;&nbsp;&nbsp;&lt;arg value= &quot;8080&quot; /&gt;  
-&nbsp;&nbsp;&nbsp;&nbsp;&lt;arg value= &quot;/axis2/services/sample1&quot; /&gt;  
-&nbsp;&nbsp;&lt;/java&gt;  
-&lt;/target&gt;  
-
-&lt;target name= &quot;echoWithHandler&quot; &gt;  
- &nbsp;&nbsp;&lt;java classname= &quot;userguide.sample1.SynchronousClient&quot; &gt;  
-&nbsp;&nbsp;&nbsp;&nbsp;&lt;classpath refid= &quot;classpath.runtimelibraries&quot; /&gt;  
-&nbsp;&nbsp;&nbsp;&nbsp;&lt;arg value= &quot;8080&quot; /&gt;  
-&nbsp;&nbsp;&nbsp;&nbsp;&lt;arg value= &quot;/axis2/services/sample1WithHandler&quot; /&gt;  
-&nbsp;&nbsp;&lt;/java&gt;  
-&lt;/target&gt; </pre>
-<p>To run the sample first the user must start the servlet container and run the client by simply typing </p>
-<p>&gt;ant echoWithHandler </p>
-<p>in the command prompt. If all goes well the user will get the following output where the program will print the request SOAP message and the response SOAP message, which will be same as the request message. </p>
-<p align="center"><img width="648" height="265" src="images/clip_image024.jpg"></p>
-<p>The service <strong>“sample1withhandler” </strong> will run its logging handler as it gets called and it will log the call as the handler gets called in the inflow. This logged information can be found in the server logs. </p>
-<h3><a name="_Toc96698093"></a>Sample1 - Case3: Echo Asynchronous call. </h3>
-<p>In this case the example focuses on calling a synchronous web service in an asynchronous manner in the client side. If this example is compared with the first example, which is <strong>“Echo Synchronous call” </strong>, the server side is identical for both the cases. The difference will be in the web service client that will be used. </p>
-<p>In this case the client will make a web service call and it will register a call back handler and sends the message out. The difference will be that the client application that is doing the web service call will not hang till the response. Rather it will get returned and once the response returns the client will get notified by way of the registered callback (This is one of the two methods this can be done in Axis 2.0. Refer <a href="ClientAPI.html">Client Api Tutorial </a> for more information). </p>
-<p>The callback handler that will be used is ClientEchoCallbackHandler.java and the client program is AsynchronousClient.java. </p>
-
-<p>It is assumed that the sample is already compiled. Please refer the "Building Sample1" above. </p>
-<p>On the other hand the Case3 uses the <strong>sample1</strong> web service. Thus if the user has already deployed sample1 web service in Case1 above then there is no requirement of deploying again. Please refer Case1 deploying to deploy the required service above.</p>
-<h4><strong>Running the sample </strong></h4>
-<p>The class to run is AsynchronousClient.java and it will intialise the web service call. It will register a call back in this case an instance of the ClientEchoCallbackHandler and then client will sleep to keep the thread alive. Eventually when the response is received the callback handler will be called(if all goes well onComplete() method will be called), in this case the ClientEchoCallbackHandler instance that was registered. </p>
-<p>Inside the ClientEchoCallbackHandler it will print the received SOAP message. Please refer the code. </p>
-<p>To run the client one can simply type </p>
-<p>&gt;ant echoAsync </p>
-<p>and it will give the following output. </p>
-<p align="center"><img width="648" height="277" src="images/clip_image026.jpg"></p>
-<p>&nbsp; </p>
-<strong><br>
-</strong>
-<h2><a name="_Toc96698094"></a>Writing your own Service and a client </h2>
-<h3><a name="_Toc96698095"></a>Writing a New Service </h3>
-<p>Writing a new Web Service in Axis2-M1 requires you to do following steps </p>
-<p><strong>&#149;&nbsp; Writing a new Web Service implementation class </strong></p>
-<p>Axis2 M1 does not support data binding and supports only the XML level messaging. The default provider (do not worry about this if you do not know what it is) only supports the java methods having the return type as OMElement and only parameter as an OMElement. </p>
-<p>The OMElement is a Streaming representation of XML Message Element Information Item (Even though the user sees the OMElement as a tree based DOM/JDOM like node, it reads the information from the stream only when its absolutely required.). For more information refer the <a href="OMTutorial.html">OM Tutorial </a>. </p>
-<pre class="style4">public class &lt;class-name&gt;{  
-&nbsp;&nbsp;public OMElelemnt &lt;method-name&gt;(OMEllemnt){  
-&nbsp;&nbsp;&nbsp;&nbsp;&lt;business logic&gt;  
-&nbsp;&nbsp;}  
-&nbsp;&nbsp;.....  
-} </pre>
-<p><strong>&#149;&nbsp; Write the service.xml file </strong></p>
-<p>the following XML snippet is a very simple service.xml file. </p>
-<pre class="style4">&lt;service provider=&quot;org.apache.axis.providers.RawXMLProvider&quot; style=&quot;rpc&quot;&gt;  
- &nbsp;&nbsp;&lt;java:implementation class=&quot;&lt;implementation-classname&gt;&quot;  xmlns:java=&quot;http://ws.apache.org/axis2/deployment/java&quot;/&gt;  
-  &nbsp;&nbsp;&lt;operation name=&quot;&lt;method-name&gt;&quot; qname=&quot;&lt;method-name&gt;&quot;/&gt; ...  
- &lt;/service&gt; </pre>
-<p>Here the org.apache.axis.providers.RawXMLProvider is the default provider for the Apache Axis2 M1, the provider can be changed by specifying the relevant parameter. Note that &lt;method-name&gt; should be replaced by the relevant method name. </p>
-<p><strong>&#149;&nbsp; Create an archive with the service.xml file and with class files </strong></p>
-<p>Compile the the Web Service implementation class and any other supporting class. Archive them in to a jar file. Place the service.xml file in the META-INF directory. </p>
-<p>Name of the archive would be the name of the service. For example if the service name is echo the archive should be echo.jar or echo.aar ( <strong>a</strong>xis <strong>ar</strong>chive) </p>
-<p><strong>&#149;&nbsp; Deploy the archive in the Axis2 </strong></p>
-<p>While the Axis2 is running copy the archive to the services folder in the repository directory or use web upload method. (in the case of a Servlet container this directory is axis/WEB-INF/services/). Axis will automatically pick the archive and deploy the service. </p>
-<p>To make this whole process user-friendly, Axis2 is shipped with a service creation GUI tool. It is
-a "wizard interface" and also provides the facility for users to automatically create a very simple
-service.xml as well. The tool start script can be found in the bin directory. 
-
-
-<h3><a name="_Toc96698096"></a>Writing a Client for the Axis2-M1 </h3>
-<p>Axis2 M1 supports HTTP transport only. Axis2-M1 supports the following interaction patterns. </p>
-<p>&#149;&nbsp; Blocking invocation of type in-out (request/response) </p>
-<p>&#149;&nbsp; Non blocking invocation of type in-out (Without a separate Listener) </p>
-<p>for more information about the interaction patterns, visit the <a href="ClientAPI.html">Client API Tutorial </a>. </p>
-<p>To invoke the web service, user needs to build the the SOAPEnvelope himself. The SOAPEnvelope can be built by the following code. </p>
-<pre class="style4">OMFactory fac = OMFactory.newInstance();  
-SOAPEnvelope envelope = fac.getDefaultEnvelope();  
-OMElement omElement = .....  
-envelope.getBody().addChild(omElement); </pre>
-<p>OMElement can be build using one of the following methods; </p>
-<ol>
-  <li>Create a OM by building the OM tree <br>
-  <span class="style4">fac.createOMElement(method, ns);</span></li>
-</ol>
-
-<ol>
-  <li>Create a OM Element from a XML file 
- <br>
- <pre class="style4">XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(file)); <br>
-  OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMFactory.newInstance(), parser); <br>
-builder.getDocumentElement();
- </span></li>
-</ol>
-<p>for more information in handling the OM objects please read the <a href="OMTutorial.html">OM Tutorial </a>. </p>
-<h4><a name="_Toc96698097"></a>Synchronous Client </h4>
-<p>Invoking the synchronous web service call can be done with the following code. </p>
-<pre class="style4">EndpointReference targetEPR = <strong>new </strong>EndpointReference(AddressingConstants.WSA_TO, &quot;http://127.0.0.1:&quot; + (EngineUtils.TESTING_PORT) + &quot;/axis/services/echo&quot; );  
-Call call = <strong>new </strong>Call();  
-call.setTo(targetEPR);  
-SOAPEnvelope responseEnv = call.sendReceive(envelope); </pre> 
-<p>&#149;&nbsp; The Endpoint Reference (EPR) is the To location of the web service. </p>
-<p>&#149;&nbsp; call.setTo() method registers the created EPR with the call object. </p>
-<p>&#149;&nbsp; call.sendRecieve() method invokes the web service at the location specified by the EPR using the given SOAP Message. </p>
-<h4><a name="_Toc96698098"></a>Asynchronous Client </h4>
-<p>Invoking the asynchronous web service call can be done with the following code. </p>
-<pre class="style4">EndpointReference targetEPR = <strong>new </strong>EndpointReference(AddressingConstants.WSA_TO, &quot;http://127.0.0.1:&quot; + (EngineUtils.TESTING_PORT)+ &quot;/axis/services/echo&quot; );  
-Call call = <strong>new </strong>Call();  
-call.setTo(targetEPR);  
-call.setListenerTransport(Constants.TRANSPORT_HTTP, <strong>true </strong>);  
-SOAPEnvelope responseEnv = call.sendReceiveAsync(envelope,callback); </pre>
-<p>&#149;&nbsp; The Endpoint Reference (EPR) is the To location of the web service. </p>
-<p>&#149;&nbsp; call.setTo() method registers the created EPR with the call object. </p>
-<p>&#149;&nbsp; call.sendRecieveAsync() method invokes the web service at the location specified by the EPR using the given SOAP Message. </p>
-<p>&#149;&nbsp; The LitenerTransport is type of the trasport to be used. Axis2-M1 only supports the http and the second parameter express the should the seperate listener is to be started or not. Axis-M1 supports only the true for this. </p>
-<p>&#149;&nbsp; callback it the Callback to handle the response e.g. </p>
-<pre class="style1 style2 style3">Callback callback = <strong>new </strong> Callback() {  
-<strong>&nbsp;&nbsp;public void </strong>onComplete(AsyncResult result) {  
-&nbsp;&nbsp;&nbsp;&nbsp;//process the result  
-&nbsp;&nbsp;}  
-&nbsp;  
-<strong>&nbsp;&nbsp;public void </strong>reportError(Exception e) {  
-&nbsp;&nbsp;&nbsp;&nbsp;//handler error  
-&nbsp;&nbsp;}  
-}</pre>
-<p>&nbsp; </p>
-<p>&nbsp; </p>
 </body>
-</html>
+</html>
\ No newline at end of file