From 5e68bf5f759b4e76a7ceebeb5199df5c3a111b82 Mon Sep 17 00:00:00 2001 From: slaws Date: Fri, 12 Mar 2010 14:46:11 +0000 Subject: fix up client to call service git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@922283 13f79535-47bb-0310-9956-ffa450edef68 --- sandbox/slaws/axis-jaxws-experiment/pom.xml | 24 +++++++++++ .../src/main/java/calculator/AddService.java | 3 ++ .../src/main/java/calculator/AddServiceImpl.java | 2 - .../src/test/java/test/Client.java | 46 +++++++++++++++++++++ .../src/test/java/test/Service.java | 3 ++ .../src/wsgenout/AddServiceImplService.wsdl | 39 +++++++++++++++++ .../src/wsgenout/AddServiceImplService_schema1.xsd | 21 ++++++++++ .../src/wsgenout/calculator/jaxws/Add.class | Bin 0 -> 907 bytes .../wsgenout/calculator/jaxws/AddResponse.class | Bin 0 -> 766 bytes sandbox/slaws/axis-jaxws-experiment/wsgen.bat | 2 +- sandbox/slaws/axis-jaxws-experiment/wsimport.bat | 2 +- 11 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 sandbox/slaws/axis-jaxws-experiment/src/test/java/test/Client.java create mode 100644 sandbox/slaws/axis-jaxws-experiment/src/wsgenout/AddServiceImplService.wsdl create mode 100644 sandbox/slaws/axis-jaxws-experiment/src/wsgenout/AddServiceImplService_schema1.xsd create mode 100644 sandbox/slaws/axis-jaxws-experiment/src/wsgenout/calculator/jaxws/Add.class create mode 100644 sandbox/slaws/axis-jaxws-experiment/src/wsgenout/calculator/jaxws/AddResponse.class diff --git a/sandbox/slaws/axis-jaxws-experiment/pom.xml b/sandbox/slaws/axis-jaxws-experiment/pom.xml index 3164ec1a64..56b5297964 100644 --- a/sandbox/slaws/axis-jaxws-experiment/pom.xml +++ b/sandbox/slaws/axis-jaxws-experiment/pom.xml @@ -68,6 +68,30 @@ ${artifactId} + + org.codehaus.mojo + build-helper-maven-plugin + 1.4 + + + add-source + generate-sources + + add-resource + + + + + src/wsimportout + + + src/wsgenout + + + + + + org.apache.maven.plugins maven-jar-plugin diff --git a/sandbox/slaws/axis-jaxws-experiment/src/main/java/calculator/AddService.java b/sandbox/slaws/axis-jaxws-experiment/src/main/java/calculator/AddService.java index 188451ebac..d20b890f99 100644 --- a/sandbox/slaws/axis-jaxws-experiment/src/main/java/calculator/AddService.java +++ b/sandbox/slaws/axis-jaxws-experiment/src/main/java/calculator/AddService.java @@ -18,9 +18,12 @@ */ package calculator; +import javax.jws.WebService; + /** * The Add service interface */ +@WebService public interface AddService { double add(double n1, double n2); diff --git a/sandbox/slaws/axis-jaxws-experiment/src/main/java/calculator/AddServiceImpl.java b/sandbox/slaws/axis-jaxws-experiment/src/main/java/calculator/AddServiceImpl.java index b289a20a9f..5318d775d9 100644 --- a/sandbox/slaws/axis-jaxws-experiment/src/main/java/calculator/AddServiceImpl.java +++ b/sandbox/slaws/axis-jaxws-experiment/src/main/java/calculator/AddServiceImpl.java @@ -23,8 +23,6 @@ import java.util.logging.Logger; import javax.jws.WebService; -import org.oasisopen.sca.annotation.Service; - /** * An implementation of the Add service */ diff --git a/sandbox/slaws/axis-jaxws-experiment/src/test/java/test/Client.java b/sandbox/slaws/axis-jaxws-experiment/src/test/java/test/Client.java new file mode 100644 index 0000000000..ac05ce2aea --- /dev/null +++ b/sandbox/slaws/axis-jaxws-experiment/src/test/java/test/Client.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package test; + +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Endpoint; +import javax.xml.ws.Service; + +import calculator.AddService; +import calculator.AddServiceImpl; + + +public class Client { + + public static void main(String[] args) throws Exception { + + // default JVM JAXWS support + // no need for wsimport first + QName serviceName = new QName("http://calculator/", "AddServiceImplService"); + QName portName = new QName("http://calculator/", "AddServiceImplPort"); + URL wsdlLocation = Client.class.getClassLoader().getResource("AddServiceImplService.wsdl"); + javax.xml.ws.Service webService = Service.create( wsdlLocation, serviceName ); + AddService wsProxy = (AddService) webService.getPort(portName, AddService.class); + System.out.println("Result1 = " + wsProxy.add(1.0, 2.0)); + + } +} diff --git a/sandbox/slaws/axis-jaxws-experiment/src/test/java/test/Service.java b/sandbox/slaws/axis-jaxws-experiment/src/test/java/test/Service.java index b44b0bb050..f8eae8a625 100644 --- a/sandbox/slaws/axis-jaxws-experiment/src/test/java/test/Service.java +++ b/sandbox/slaws/axis-jaxws-experiment/src/test/java/test/Service.java @@ -27,6 +27,9 @@ import calculator.AddServiceImpl; public class Service { public static void main(String[] args) throws Exception { + + // default JVM JAXWS support. + // must have used wsgen first Endpoint.publish("http://localhost:8080/Test/Add", new AddServiceImpl()); diff --git a/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/AddServiceImplService.wsdl b/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/AddServiceImplService.wsdl new file mode 100644 index 0000000000..b07f05ad66 --- /dev/null +++ b/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/AddServiceImplService.wsdl @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/AddServiceImplService_schema1.xsd b/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/AddServiceImplService_schema1.xsd new file mode 100644 index 0000000000..735f19bff3 --- /dev/null +++ b/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/AddServiceImplService_schema1.xsd @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/calculator/jaxws/Add.class b/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/calculator/jaxws/Add.class new file mode 100644 index 0000000000..b8ddbef0b8 Binary files /dev/null and b/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/calculator/jaxws/Add.class differ diff --git a/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/calculator/jaxws/AddResponse.class b/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/calculator/jaxws/AddResponse.class new file mode 100644 index 0000000000..e5db5e0e47 Binary files /dev/null and b/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/calculator/jaxws/AddResponse.class differ diff --git a/sandbox/slaws/axis-jaxws-experiment/wsgen.bat b/sandbox/slaws/axis-jaxws-experiment/wsgen.bat index 5a8f49537b..2a61f3dee4 100644 --- a/sandbox/slaws/axis-jaxws-experiment/wsgen.bat +++ b/sandbox/slaws/axis-jaxws-experiment/wsgen.bat @@ -1 +1 @@ -c:\simon\apps\j2sdk6.0-ibm\bin\wsgen.exe -cp target/classes;"C:\Documents and Settings\slaws\.m2\repository\org\apache\tuscany\sca\tuscany-sca-api\2.0-SNAPSHOT\tuscany-sca-api-2.0-SNAPSHOT.jar" -r src/main/resources -s src/main/java -wsdl calculator.AddServiceImpl +c:\simon\apps\j2sdk6.0-ibm\bin\wsgen.exe -cp target/classes;"C:\Documents and Settings\slaws\.m2\repository\org\apache\tuscany\sca\tuscany-sca-api\2.0-SNAPSHOT\tuscany-sca-api-2.0-SNAPSHOT.jar" -d src/wsgenout -wsdl -verbose calculator.AddServiceImpl diff --git a/sandbox/slaws/axis-jaxws-experiment/wsimport.bat b/sandbox/slaws/axis-jaxws-experiment/wsimport.bat index e63ebb7059..dc9504149e 100644 --- a/sandbox/slaws/axis-jaxws-experiment/wsimport.bat +++ b/sandbox/slaws/axis-jaxws-experiment/wsimport.bat @@ -1 +1 @@ -c:\simon\apps\j2sdk6.0-ibm\bin\wsimport.exe TBD +c:\simon\apps\j2sdk6.0-ibm\bin\wsimport.exe -d src/wsimportout -verbose src/wsgenout/AddServiceImplService.wsdl -- cgit v1.2.3