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/07 04:49:22 UTC

svn commit: r188672 - in /webservices/axis/trunk/java/modules/samples/src/userguide/clients: ClientForWebServiceWithModule.java bin/TestWebServiceWithModuleClient.bat

Author: jaliya
Date: Mon Jun  6 19:49:21 2005
New Revision: 188672

URL: http://svn.apache.org/viewcvs?rev=188672&view=rev
Log:
Client to access the service with a module

Added:
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/ClientForWebServiceWithModule.java
    webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestWebServiceWithModuleClient.bat

Added: webservices/axis/trunk/java/modules/samples/src/userguide/clients/ClientForWebServiceWithModule.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/ClientForWebServiceWithModule.java?rev=188672&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/ClientForWebServiceWithModule.java (added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/ClientForWebServiceWithModule.java Mon Jun  6 19:49:21 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 ClientForWebServiceWithModule {
+    private static EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
+            "http://127.0.0.1:8080/axis2/services/WebServiceWithModule/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/bin/TestWebServiceWithModuleClient.bat
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestWebServiceWithModuleClient.bat?rev=188672&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestWebServiceWithModuleClient.bat (added)
+++ webservices/axis/trunk/java/modules/samples/src/userguide/clients/bin/TestWebServiceWithModuleClient.bat Mon Jun  6 19:49:21 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.ClientForWebServiceWithModule
\ No newline at end of file