axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jal...@apache.org
Subject svn commit: r180221 - in /webservices/axis/trunk/java/modules/samples/src/userguide/clients: ./ bin/
Date Mon, 06 Jun 2005 05:03:30 GMT
Author: jaliya
Date: Sun Jun  5 22:03:28 2005
New Revision: 180221

URL: http://svn.apache.org/viewcvs?rev=180221&view=rev
Log:
Test clients and the respective bat files to test them

Added:
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoBlockingClient.bat
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoBlockingDualClient.bat
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoNonBlockingClient.bat
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoNonBlockingDualClient.bat
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestPingClient.bat
Removed:
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoClient.java
Modified:
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/PingClient.java

Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java?rev=180221&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java
(added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingClient.java
Sun Jun  5 22:03:28 2005
@@ -0,0 +1,56 @@
+package userguide.clients;
+
+import org.apache.axis.Constants;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.Call;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMElement;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import java.io.StringWriter;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+public class EchoBlockingClient {
+    private static EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
+            "http://127.0.0.1:8080/axis2/services/MyService/echo");
+
+    public static void main(String[] args) {
+        try {
+            OMElement payload = ClientUtil.getEchoOMElement();
+            Call call = new Call();
+            call.setTo(targetEPR);
+            call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
+
+            //Blocking invocation
+            OMElement result = (OMElement) call.invokeBlocking("echo", payload);
+
+            StringWriter writer = new StringWriter();
+            result.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
+            writer.flush();
+
+            System.out.println(writer.toString());
+
+        } catch (AxisFault axisFault) {
+            axisFault.printStackTrace();
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+        }
+    }
+}

Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java?rev=180221&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java
(added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoBlockingDualClient.java
Sun Jun  5 22:03:28 2005
@@ -0,0 +1,75 @@
+package userguide.clients;
+
+import org.apache.axis.Constants;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.AsyncResult;
+import org.apache.axis.clientapi.Call;
+import org.apache.axis.clientapi.Callback;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMElement;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import java.io.StringWriter;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jaliya
+ * Date: Jun 4, 2005
+ * Time: 5:47:37 PM
+ */
+public class EchoBlockingDualClient {
+    private static EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
+            "http://127.0.0.1:8080/axis2/services/SimpleService/echo");
+
+    public static void main(String[] args) {
+        try {
+            OMElement payload = ClientUtil.getEchoOMElement();
+
+            Call call = new Call();
+            call.setTo(targetEPR);
+
+            //The boolean flag informs the axis2 engine to use two separate transport connection
+            //to retrieve the response.
+            call.engageModule(new QName("addressing"));
+            call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, true);
+
+            //Callback to handle the response
+            Callback callback = new Callback() {
+                public void onComplete(AsyncResult result) {
+                    try {
+                        StringWriter writer = new StringWriter();
+                        result.getResponseEnvelope().serializeWithCache(
+                                XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
+                        writer.flush();
+
+                        System.out.println(writer.toString());
+
+                    } catch (XMLStreamException e) {
+                        reportError(e);
+                    }
+                }
+
+                public void reportError(Exception e) {
+                    e.printStackTrace();
+                }
+            };
+
+            //Non-Blocking Invocation
+            call.invokeNonBlocking("echo", payload, callback);
+
+            //Wait till the callback receives the response.
+            while (!callback.isComplete()) {
+                Thread.sleep(1000);
+            }
+
+        } catch (AxisFault axisFault) {
+            axisFault.printStackTrace();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+    }
+}

Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java?rev=180221&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java
(added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingClient.java
Sun Jun  5 22:03:28 2005
@@ -0,0 +1,70 @@
+package userguide.clients;
+
+import org.apache.axis.Constants;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.AsyncResult;
+import org.apache.axis.clientapi.Call;
+import org.apache.axis.clientapi.Callback;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMElement;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import java.io.StringWriter;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jaliya
+ * Date: Jun 4, 2005
+ * Time: 5:08:44 PM
+ */
+public class EchoNonBlockingClient {
+    private static EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
+            "http://127.0.0.1:8080/axis2/services/MyService/echo");
+
+    public static void main(String[] args) {
+        try {
+            OMElement payload = ClientUtil.getEchoOMElement();
+
+            Call call = new Call();
+            call.setTo(targetEPR);
+            call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
+
+            //Callback to handle the response
+            Callback callback = new Callback() {
+                public void onComplete(AsyncResult result) {
+                    try {
+                        StringWriter writer = new StringWriter();
+                        result.getResponseEnvelope().serializeWithCache(
+                                XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
+                        writer.flush();
+
+                        System.out.println(writer.toString());
+
+                    } catch (XMLStreamException e) {
+                        reportError(e);
+                    }
+                }
+
+                public void reportError(Exception e) {
+                    e.printStackTrace();
+                }
+            };
+
+            //Non-Blocking Invocation
+            call.invokeNonBlocking("echo", payload, callback);
+
+            //Wait till the callback receives the response.
+            while (!callback.isComplete()) {
+                Thread.sleep(1000);
+            }
+
+        } catch (AxisFault axisFault) {
+            axisFault.printStackTrace();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+    }
+}

Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java?rev=180221&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java
(added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/EchoNonBlockingDualClient.java
Sun Jun  5 22:03:28 2005
@@ -0,0 +1,76 @@
+package userguide.clients;
+
+import org.apache.axis.Constants;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.AsyncResult;
+import org.apache.axis.clientapi.Call;
+import org.apache.axis.clientapi.Callback;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMElement;
+
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
+import java.io.StringWriter;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Jaliya
+ * Date: Jun 4, 2005
+ * Time: 5:30:52 PM
+ */
+public class EchoNonBlockingDualClient {
+    private static EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
+            "http://127.0.0.1:8070/axis2/services/SimpleService/echo");
+
+    public static void main(String[] args) {
+        try {
+            OMElement payload = ClientUtil.getEchoOMElement();
+
+            Call call = new Call();
+            call.setTo(targetEPR);
+
+            //The boolean flag informs the axis2 engine to use two separate transport connection
+            //to retrieve the response.
+            call.engageModule(new QName("addressing"));
+            call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, true);
+
+            //Callback to handle the response
+            Callback callback = new Callback() {
+                public void onComplete(AsyncResult result) {
+                    try {
+                        StringWriter writer = new StringWriter();
+                        result.getResponseEnvelope().serializeWithCache(
+                                XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
+                        writer.flush();
+
+                        System.out.println(writer.toString());
+
+                    } catch (XMLStreamException e) {
+                        reportError(e);
+                    }
+                }
+
+                public void reportError(Exception e) {
+                    e.printStackTrace();
+                }
+            };
+
+            //Non-Blocking Invocation
+            call.invokeNonBlocking("echo", payload, callback);
+
+            //Wait till the callback receives the response.
+            while (!callback.isComplete()) {
+                Thread.sleep(1000);
+            }
+
+        } catch (AxisFault axisFault) {
+            axisFault.printStackTrace();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+    }
+}

Modified: webservices/axis/trunk/java/modules/samples/src/userguide/clients/PingClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/PingClient.java?rev=180221&r1=180220&r2=180221&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/PingClient.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/PingClient.java Sun
Jun  5 22:03:28 2005
@@ -1,22 +1,11 @@
 package userguide.clients;
 
-import org.apache.axis.engine.AxisFault;
-import org.apache.axis.clientapi.Call;
-import org.apache.axis.clientapi.MessageSender;
-import org.apache.axis.addressing.EndpointReference;
-import org.apache.axis.addressing.AddressingConstants;
 import org.apache.axis.Constants;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.MessageSender;
+import org.apache.axis.engine.AxisFault;
 import org.apache.axis.om.OMElement;
-import org.apache.axis.soap.SOAPEnvelope;
-
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.namespace.QName;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.io.StringWriter;
 
 /**
  * Created by IntelliJ IDEA.
@@ -25,29 +14,22 @@
  * Time: 2:11:25 PM
  */
 public class PingClient {
-      private static String IP="http://127.0.0.1:8080";
     private static EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
-                    IP + "/axis2/services/MyService/echo");
-      private static QName operationName = new QName("echo");
-    private static String value;
-    public static void main(String[] args) throws AxisFault{
+            "http://127.0.0.1:8080/axis2/services/MyService/ping");
 
-          try {
+    public static void main(String[] args) {
+        try {
             OMElement payload = ClientUtil.getPingOMElement();
 
-              MessageSender msgSender= new MessageSender();
-              msgSender.setTo(targetEPR);
-              msgSender.setSenderTransport(Constants.TRANSPORT_HTTP);
-
-              msgSender.send("ping",payload);
-
+            MessageSender msgSender = new MessageSender();
+            msgSender.setTo(targetEPR);
+            msgSender.setSenderTransport(Constants.TRANSPORT_HTTP);
 
+            msgSender.send("ping", payload);
 
         } catch (AxisFault axisFault) {
-            value = axisFault.getMessage();
-
+            axisFault.printStackTrace();
         }
     }
-
 
 }

Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoBlockingClient.bat
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoBlockingClient.bat?rev=180221&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoBlockingClient.bat
(added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoBlockingClient.bat
Sun Jun  5 22:03:28 2005
@@ -0,0 +1,10 @@
+@echo off
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/axis2-M2.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/stax-api-1.0.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/stax-1.1.1-dev.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/log4j-1.2.8.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/commons-logging-1.0.3.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/commons-fileupload-1.0.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/axis-wsdl4j-1.2.jar
+set CLASSPATH=%CLASSPATH%;../../../../sample.jar
+java userguide.clients.EchoBlockingClient
\ No newline at end of file

Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoBlockingDualClient.bat
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoBlockingDualClient.bat?rev=180221&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoBlockingDualClient.bat
(added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoBlockingDualClient.bat
Sun Jun  5 22:03:28 2005
@@ -0,0 +1,10 @@
+@echo off
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/axis2-M2.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/stax-api-1.0.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/stax-1.1.1-dev.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/log4j-1.2.8.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/commons-logging-1.0.3.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/commons-fileupload-1.0.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/axis-wsdl4j-1.2.jar
+set CLASSPATH=%CLASSPATH%;../../../../sample.jar
+java userguide.clients.EchoBlockingDualClient
\ No newline at end of file

Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoNonBlockingClient.bat
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoNonBlockingClient.bat?rev=180221&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoNonBlockingClient.bat
(added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoNonBlockingClient.bat
Sun Jun  5 22:03:28 2005
@@ -0,0 +1,10 @@
+@echo off
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/axis2-M2.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/stax-api-1.0.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/stax-1.1.1-dev.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/log4j-1.2.8.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/commons-logging-1.0.3.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/commons-fileupload-1.0.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/axis-wsdl4j-1.2.jar
+set CLASSPATH=%CLASSPATH%;../../../../sample.jar
+java userguide.clients.EchoNonBlockingClient
\ No newline at end of file

Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoNonBlockingDualClient.bat
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoNonBlockingDualClient.bat?rev=180221&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoNonBlockingDualClient.bat
(added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestEchoNonBlockingDualClient.bat
Sun Jun  5 22:03:28 2005
@@ -0,0 +1,10 @@
+@echo off
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/axis2-M2.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/stax-api-1.0.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/stax-1.1.1-dev.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/log4j-1.2.8.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/commons-logging-1.0.3.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/commons-fileupload-1.0.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/axis-wsdl4j-1.2.jar
+set CLASSPATH=%CLASSPATH%;../../../../sample.jar
+java userguide.clients.EchoNonBlockingDualClient
\ No newline at end of file

Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestPingClient.bat
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestPingClient.bat?rev=180221&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestPingClient.bat
(added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestPingClient.bat
Sun Jun  5 22:03:28 2005
@@ -0,0 +1,10 @@
+@echo off
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/axis2-M2.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/stax-api-1.0.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/stax-1.1.1-dev.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/log4j-1.2.8.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/commons-logging-1.0.3.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/commons-fileupload-1.0.jar
+set CLASSPATH=%CLASSPATH%;../../../../../../lib/axis-wsdl4j-1.2.jar
+set CLASSPATH=%CLASSPATH%;../../../../sample.jar
+java userguide.clients.PingClient
\ No newline at end of file



Mime
View raw message