Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 56584 invoked from network); 24 Apr 2006 11:20:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Apr 2006 11:20:42 -0000 Received: (qmail 56221 invoked by uid 500); 24 Apr 2006 11:20:12 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 56141 invoked by uid 500); 24 Apr 2006 11:20:12 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 56130 invoked by uid 500); 24 Apr 2006 11:20:12 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 56126 invoked by uid 99); 24 Apr 2006 11:20:12 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Apr 2006 04:20:12 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 24 Apr 2006 04:20:11 -0700 Received: (qmail 56004 invoked by uid 65534); 24 Apr 2006 11:19:51 -0000 Message-ID: <20060424111951.56003.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r396516 - in /webservices/axis2/trunk/java/xdocs/latest: userguide2.html userguide3.html Date: Mon, 24 Apr 2006 11:19:47 -0000 To: axis2-cvs@ws.apache.org From: chinthaka@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: chinthaka Date: Mon Apr 24 04:19:45 2006 New Revision: 396516 URL: http://svn.apache.org/viewcvs?rev=396516&view=rev Log: Some improvements to the userguide. Modified: webservices/axis2/trunk/java/xdocs/latest/userguide2.html webservices/axis2/trunk/java/xdocs/latest/userguide3.html Modified: webservices/axis2/trunk/java/xdocs/latest/userguide2.html URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/latest/userguide2.html?rev=396516&r1=396515&r2=396516&view=diff ============================================================================== --- webservices/axis2/trunk/java/xdocs/latest/userguide2.html (original) +++ webservices/axis2/trunk/java/xdocs/latest/userguide2.html Mon Apr 24 04:19:45 2006 @@ -105,9 +105,11 @@ <parameter name="ServiceClass" locked="false">userguide.example1.MyService</parameter> <operation name="echo"> <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> + <actionMapping>urn:echo</actionMapping> </operation> <operation name="ping"> <messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> + <actionMapping>urn:ping</actionMapping> </operation> </service> @@ -124,15 +126,18 @@
   <operation name="echo">
             <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+            <actionMapping>urn:echo</actionMapping>
    </operation>
    <operation name="ping">
        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+       <actionMapping>urn:ping</actionMapping>
    </operation>

Every operation must have a corresponding MessageReceiver class. When Axis2 engine receives a message, after the message is being processed by the handlers, it will be handed over to a MessageReceiver.
For the "echo" operation we have used a RawXMLINOutMessageReceiver since it is an IN-OUT operation. For IN-ONLY operation "ping", we have used RawXMLINOnlyMessageReceiver as the message receiver.

+

The actionMapping is required only if you want to enable WS-Addressing. This will be used later in this user guide.

You can write a services.xml file to include a group of services instead of a single service. This makes management and deployment of a set of related Modified: webservices/axis2/trunk/java/xdocs/latest/userguide3.html URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/xdocs/latest/userguide3.html?rev=396516&r1=396515&r2=396516&view=diff ============================================================================== --- webservices/axis2/trunk/java/xdocs/latest/userguide3.html (original) +++ webservices/axis2/trunk/java/xdocs/latest/userguide3.html Mon Apr 24 04:19:45 2006 @@ -4,7 +4,7 @@ Axis2 User's Guide - + @@ -163,26 +163,18 @@ OMElement payload = ClientUtil.getEchoOMElement(); Options options = new Options(); - options.setTo(targetEPR); - options.setListenerTransportProtocol(Constants.TRANSPORT_HTTP); - options.setUseSeparateListener(false); - + options.setTo(targetEPR); // this sets the location of MyService service + ServiceClient serviceClient = new ServiceClient(); serviceClient.setOptions(options); OMElement result = sender.sendReceive(payload); - StringWriter writer = new StringWriter(); - result.serializeWithCache(new OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(writer))); - writer.flush(); - - System.out.println(writer.toString()); + System.out.println(result); } catch (AxisFault axisFault) { axisFault.printStackTrace(); - } catch (XMLStreamException e) { - e.printStackTrace(); - } + } }

The green lines shows the set of operations that you need to perform @@ -195,7 +187,7 @@

PingClient

-

In the Web Service "MyService" we had a IN-ONLY operation with the name +

In the Web Service "MyService" we had an IN-ONLY operation with the name "ping" (see Web Services Using Axis2). Let's write a client to invoke this operation. The client code is as follows:

@@ -217,7 +209,7 @@ axisFault.printStackTrace(); } -

Since we are accessing a IN-ONLY operation we can directly use the +

Since we are accessing an IN-ONLY operation we can directly use the "fireAndForget()" in ServiceClient to invoke this operation , and that will not block the invocation, hence it will return the control immediately back to the client. You can test this client by running the target @@ -231,9 +223,9 @@

In the EchoBlockingClient once the "serviceCleint.sendReceive(payload);" 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 +behavior is not desirable when there are many Web service invocations to be +done in a single client application or within a GUI. A solution would be to use a +Non-Blocking API to invoke Web services. Axis2 provides a callback based non-blocking API for users.

A sample client for this can be found under @@ -275,7 +267,7 @@

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). -WS-Addressing provides a neat solution to this using <wsa:MessageID> and <wsa:RelatesTo> headers. Axis2 provides support for addressing  based correlation mechanism and a complying Client @@ -299,25 +291,15 @@ //The boolean flag informs the axis2 engine to use two separate transport connection //to retrieve the response.
options.setUseSeparateListener(true); - options.setAction("urn:echo"); + options.setAction("urn:echo"); // this is the action mapping we put within the service.xml - ServiceClient serviceClinet = new ServiceClinet(); -
serviceClinet.setOptions(options); + ServiceClient serviceClient = new ServiceClient(); +
serviceClient.setOptions(options);

                  
             //Callback to handle the response
             Callback callback = new Callback() {
                 public void onComplete(AsyncResult result) {
-                    try {
-                        StringWriter writer = new StringWriter();
-                        result.serializeWithCache(new OMOutput(XMLOutputFactory.newInstance()
-                                                                .createXMLStreamWriter(writer)));
-                        writer.flush();
-
-                        System.out.println(writer.toString());
-
-                    } catch (XMLStreamException e) {
-                        onError(e);
-                    }
+                    System.out.println(result.getResponseEnvelope());
                 }
 
                 public void onError(Exception e) {
@@ -326,13 +308,13 @@
             };
 
             //Non-Blocking Invocation
-            serviceClinet.sendReceiveNonBlocking(payload, callback);
+            serviceClient.sendReceiveNonBlocking(payload, callback);
 
             //Wait till the callback receives the response.
             while (!callback.isComplete()) {
                 Thread.sleep(1000);
             }
-            serviceClinet.finalizeInvoke();
+            serviceClient.finalizeInvoke();
 
         } catch (AxisFault axisFault) {
             axisFault.printStackTrace();