diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-03-12 14:46:11 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-03-12 14:46:11 +0000 |
commit | 5e68bf5f759b4e76a7ceebeb5199df5c3a111b82 (patch) | |
tree | 91cd13b083d78c0c70215869b11e1cbf7469b34d /sandbox | |
parent | 9d13f8bdc031b2df3c551020285248813c91f3db (diff) |
fix up client to call service
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@922283 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox')
11 files changed, 138 insertions, 4 deletions
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 @@ -69,6 +69,30 @@ <finalName>${artifactId}</finalName> <plugins> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.4</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-resource</goal> + </goals> + <configuration> + <resources> + <resource> + <directory>src/wsimportout</directory> + </resource> + <resource> + <directory>src/wsgenout</directory> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.2</version> 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 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.1 in JDK 6. --> +<definitions targetNamespace="http://calculator/" name="AddServiceImplService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://calculator/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> + <types> + <xsd:schema> + <xsd:import namespace="http://calculator/" schemaLocation="AddServiceImplService_schema1.xsd"/> + </xsd:schema> + </types> + <message name="add"> + <part name="parameters" element="tns:add"/> + </message> + <message name="addResponse"> + <part name="parameters" element="tns:addResponse"/> + </message> + <portType name="AddServiceImpl"> + <operation name="add"> + <input message="tns:add"/> + <output message="tns:addResponse"/> + </operation> + </portType> + <binding name="AddServiceImplPortBinding" type="tns:AddServiceImpl"> + <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> + <operation name="add"> + <soap:operation soapAction=""/> + <input> + <soap:body use="literal"/> + </input> + <output> + <soap:body use="literal"/> + </output> + </operation> + </binding> + <service name="AddServiceImplService"> + <port name="AddServiceImplPort" binding="tns:AddServiceImplPortBinding"> + <soap:address location="REPLACE_WITH_ACTUAL_URL"/> + </port> + </service> +</definitions> + 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 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<xs:schema version="1.0" targetNamespace="http://calculator/" xmlns:tns="http://calculator/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element name="add" type="tns:add"/> + + <xs:element name="addResponse" type="tns:addResponse"/> + + <xs:complexType name="add"> + <xs:sequence> + <xs:element name="arg0" type="xs:double"/> + <xs:element name="arg1" type="xs:double"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="addResponse"> + <xs:sequence> + <xs:element name="return" type="xs:double"/> + </xs:sequence> + </xs:complexType> +</xs:schema> + 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 Binary files differnew file mode 100644 index 0000000000..b8ddbef0b8 --- /dev/null +++ b/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/calculator/jaxws/Add.class 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 Binary files differnew file mode 100644 index 0000000000..e5db5e0e47 --- /dev/null +++ b/sandbox/slaws/axis-jaxws-experiment/src/wsgenout/calculator/jaxws/AddResponse.class 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 |