diff options
12 files changed, 533 insertions, 209 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/pom.xml b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/pom.xml index 6b9c35c415..fd9f25644f 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/pom.xml +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/pom.xml @@ -118,53 +118,336 @@ <version>2.0-SNAPSHOT</version> </dependency> + <!-- Axis dependencies and other related dependencies --> +<!-- + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-kernel</artifactId> + <version>1.5.1</version> + <exclusions> + <exclusion> + <groupId>xerces</groupId> + <artifactId>xmlParserAPIs</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-adb</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.ant</groupId> + <artifactId>ant</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.ant</groupId> + <artifactId>ant-launcher</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-java2wsdl</artifactId> + <version>1.5.1</version> + <exclusions> + <exclusion> + <groupId>org.apache.ant</groupId> + <artifactId>ant</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.ant</groupId> + <artifactId>ant-launcher</artifactId> + </exclusion> + <exclusion> + <groupId>xom</groupId> + <artifactId>xom</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-codegen</artifactId> + <version>1.5.1</version> + <scope>runtime</scope> + <exclusions> + <exclusion> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-adb</artifactId> + </exclusion> + <exclusion> + <groupId>stax</groupId> + <artifactId>stax-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-mtompolicy</artifactId> + <version>1.5.1</version> + </dependency> + + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>mex</artifactId> + <version>1.5.1</version> + <classifier>impl</classifier> + </dependency> + + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-transport-http</artifactId> + <version>1.5.1</version> + </dependency> + + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-transport-local</artifactId> + <version>1.5.1</version> + </dependency> + + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-transport-jms</artifactId> + <version>1.0.0</version> + </dependency> + + <dependency> + <groupId>org.apache.ws.commons.axiom</groupId> + <artifactId>axiom-api</artifactId> + <version>1.2.8</version> + </dependency> + + <dependency> + <groupId>org.apache.ws.commons.axiom</groupId> + <artifactId>axiom-impl</artifactId> + <version>1.2.8</version> + </dependency> + + <dependency> + <groupId>org.apache.ws.commons.axiom</groupId> + <artifactId>axiom-dom</artifactId> + <version>1.2.8</version> + </dependency> + + <dependency> + <groupId>org.apache.neethi</groupId> + <artifactId>neethi</artifactId> + <version>2.0.4</version> + <exclusions> + <exclusion> + <groupId>org.codehaus.woodstox</groupId> + <artifactId>wstx-asl</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>3.1</version> + </dependency> + + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore</artifactId> + <version>4.0.1</version> + </dependency> + + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore-nio</artifactId> + <version>4.0.1</version> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.1.1</version> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2</version> + </dependency> + + <dependency> + <groupId>commons-discovery</groupId> + <artifactId>commons-discovery</artifactId> + <version>0.4</version> + </dependency> + + <dependency> + <groupId>org.apache.santuario</groupId> + <artifactId>xmlsec</artifactId> + <version>1.4.3</version> + </dependency> + + <dependency> + <groupId>org.apache.ws.security</groupId> + <artifactId>wss4j</artifactId> + <version>1.5.4</version> + <exclusions> + <exclusion> + <groupId>bouncycastle</groupId> + <artifactId>bcprov-jdk13</artifactId> + </exclusion> + <exclusion> + <groupId>bouncycastle</groupId> + <artifactId>bcprov-jdk15</artifactId> + </exclusion> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + <exclusion> + <groupId>xml-apis</groupId> + <artifactId>xml-apis</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.apache.rampart</groupId> + <artifactId>rampart-core</artifactId> + <version>1.4</version> + <exclusions> + <exclusion> + <groupId>org.apache.ant</groupId> + <artifactId>ant-nodeps</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.axis2</groupId> + <artifactId>addressing</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-xmlbeans</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.axis2</groupId> + <artifactId>mex</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-adb</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-codegen</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-adb-codegen</artifactId> + </exclusion> + <exclusion> + <groupId>xmlbeans</groupId> + <artifactId>xbean</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.ws.commons.schema</groupId> + <artifactId>XmlSchema</artifactId> + </exclusion> + <exclusion> + <groupId>stax</groupId> + <artifactId>stax-api</artifactId> + </exclusion> + <exclusion> + <groupId>bouncycastle</groupId> + <artifactId>bcprov-jdk13</artifactId> + </exclusion> + <exclusion> + <groupId>bouncycastle</groupId> + <artifactId>bcprov-jdk15</artifactId> + </exclusion> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + <exclusion> + <groupId>xml-apis</groupId> + <artifactId>xml-apis</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> +--> + <!-- xerces, xalan, and xml-apis are required for running in websphere --> +<!-- + <dependency> + <groupId>xalan</groupId> + <artifactId>xalan</artifactId> + <version>2.7.0</version> + <scope>optional</scope> + <exclusions> + <exclusion> + <groupId>xml-apis</groupId> + <artifactId>xml-apis</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + <version>2.8.1</version> + <exclusions> + <exclusion> + <groupId>xml-apis</groupId> + <artifactId>xml-apis</artifactId> + </exclusion> + </exclusions> + </dependency> +--> + <!-- Test dependencies --> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-node-impl</artifactId> <version>2.0-SNAPSHOT</version> <scope>test</scope> </dependency> + <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-implementation-java-runtime</artifactId> <version>2.0-SNAPSHOT</version> <scope>test</scope> </dependency> + + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jms_1.1_spec</artifactId> + <version>1.1.1</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + <scope>provided</scope> + </dependency> + </dependencies> <build> <plugins> - <!-- comment out the following to build offline --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <version>1.1</version> - - <executions> - <execution> - <id>install-wsdl</id> - <phase>validate</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <tasks> - <mkdir dir="${basedir}/src/test/resources/wsdl/" /> - <get src="http://www.webservicex.net/WeatherForecast.asmx?wsdl" - dest="${basedir}/src/test/resources/wsdl/WeatherForecast.wsdl" verbose="true" - usetimestamp="true" /> - </tasks> - </configuration> - </execution> - </executions> - </plugin> - <!-- end of offline excluded section --> + <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> @@ -172,6 +455,7 @@ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine> </configuration> </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> @@ -204,6 +488,7 @@ </execution> </executions> </plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> @@ -227,9 +512,11 @@ <groupId>org.codehaus.mojo</groupId> <artifactId>jaxws-maven-plugin</artifactId> <version>1.12</version> +--> <!-- Explicitly add the transitive dependencies for jaxws-api http://jira.codehaus.org/browse/MEV-498 --> +<!-- <dependencies> <dependency> <groupId>javax.jws</groupId> @@ -265,6 +552,7 @@ <xnocompile>true</xnocompile> </configuration> </plugin> +--> </plugins> </build> diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java index ecb3b4f87b..920b9c43fc 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java @@ -46,6 +46,7 @@ import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.DataExchangeSemantics; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; +import org.w3c.dom.Document; import org.w3c.dom.Node; /** @@ -159,7 +160,11 @@ public class JAXWSBindingInvoker implements Invoker, DataExchangeSemantics { javax.xml.soap.SOAPEnvelope envelope = soapPart.getEnvelope(); javax.xml.soap.SOAPBody body = envelope.getBody(); Object[] args = (Object[])msg.getBody(); - body.addDocument(((Node)args[0]).getOwnerDocument()); + // In the unit test the owner doc is null + // so explicitly adopt the node instead + //body.addDocument(((Node)args[0]).getOwnerDocument()); + Node msgNode = body.getOwnerDocument().importNode((Node)args[0], true); + body.appendChild(msgNode); soapMessage.saveChanges(); if (operation.isNonBlocking()) { dispatch.invokeOneWay(soapMessage); diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSReferenceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSReferenceBindingProvider.java index b8ff7ce475..99a297e074 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSReferenceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSReferenceBindingProvider.java @@ -46,7 +46,7 @@ public class JAXWSReferenceBindingProvider implements ReferenceBindingProvider { throw new ServiceRuntimeException("No WSDL document for " + endpointReference.getURI()); } - // Set to use the Axiom data binding + // Set to use the DOM data binding InterfaceContract contract = wsBinding.getBindingInterfaceContract(); if (contract.getInterface() != null) { contract.getInterface().resetDataBinding(Node.class.getName()); diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java index 2be6963e15..95e64f5ad2 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSServiceBindingProvider.java @@ -77,7 +77,7 @@ public class JAXWSServiceBindingProvider implements ServiceBindingProvider, Prov throw new ServiceRuntimeException("No WSDL document for " + endpoint.getURI()); } - // Set to use the Axiom data binding + // Set to use the DOM data binding InterfaceContract contract = wsBinding.getBindingInterfaceContract(); contract.getInterface().resetDataBinding(Node.class.getName()); @@ -117,7 +117,8 @@ public class JAXWSServiceBindingProvider implements ServiceBindingProvider, Prov } Message requestMsg = messageFactory.createMessage(); - requestMsg.setBody(root); + Object[] body = new Object[]{root}; + requestMsg.setBody(body); requestMsg.setOperation(operation); Message responseMsg = endpoint.invoke(operation, requestMsg); Element element = responseMsg.getBody(); diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/weather/BindingWSJAXWSTestCase.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java index a9d74553dc..967babeae5 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/weather/BindingWSJAXWSTestCase.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/WSDLPortTestCase.java @@ -17,45 +17,35 @@ * under the License. */ -package weather; +package org.apache.tuscany.sca.binding.ws.axis2; +import junit.framework.TestCase; + +import org.apache.tuscany.sca.binding.ws.axis2.helloworld.HelloWorld; import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -/** - * - */ -public class BindingWSJAXWSTestCase { - private static Node node; - - /** - * @throws java.lang.Exception - */ - @BeforeClass - public static void setUpBeforeClass() throws Exception { - String location = ContributionLocationHelper.getContributionLocation(WeatherForecastImpl.class); - node = NodeFactory.getInstance().createNode("WeatherForecast.composite", new Contribution("c1", location)); - node.start(); - } +public class WSDLPortTestCase extends TestCase { + + private Node node; + private HelloWorld helloWorld; - @Test - public void testJAXWS() throws Exception { - WeatherForecastClient.testJAXWS(node); + public void testCalculator() throws Exception { + assertEquals("Hello petra", helloWorld.getGreetings("petra")); } - /** - * @throws java.lang.Exception - */ - @AfterClass - public static void tearDownAfterClass() throws Exception { - if (node != null) { - node.stop(); - } + @Override + protected void setUp() throws Exception { + node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.composite", + new Contribution("test", "target/test-classes")); + node.start(); + helloWorld = node.getService(HelloWorld.class, "HelloWorldClient"); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); } } diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java new file mode 100644 index 0000000000..98eb6e361b --- /dev/null +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorld.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.binding.ws.axis2.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorld { + + String getGreetings(String s); + +} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/weather/WeatherForecastImpl.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldClient.java index d3b44450a7..2c6c4fc92c 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/weather/WeatherForecastImpl.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldClient.java @@ -6,38 +6,30 @@ * 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. + * under the License. */ -package weather; +package org.apache.tuscany.sca.binding.ws.axis2.helloworld; import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; -import com.example.weather.WeatherForecastSoap; -import com.example.weather.WeatherForecasts; +public class HelloWorldClient implements HelloWorld { -/** - * @version $Rev$ $Date$ - */ -@Service(WeatherForecastSoap.class) -public class WeatherForecastImpl implements WeatherForecastSoap{ @Reference - protected WeatherForecastSoap weatherForecast; - - public WeatherForecasts getWeatherByPlaceName(String placeName) { - return weatherForecast.getWeatherByPlaceName(placeName); + public HelloWorld helloWorldWS; + + public String getGreetings(String s) { + String response = helloWorldWS.getGreetings(s); + System.out.println("At client: " + response); + return response; } - public WeatherForecasts getWeatherByZipCode(String zipCode) { - return weatherForecast.getWeatherByZipCode(zipCode); - } } diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..3662007984 --- /dev/null +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/helloworld/HelloWorldService.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.ws.axis2.helloworld; + +public class HelloWorldService implements HelloWorld { + + public String getGreetings(String s) { + String response = "Hello " + s; + System.out.println("At service: " + response); + return response; + } + +} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/weather/WeatherForecastClient.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/weather/WeatherForecastClient.java deleted file mode 100644 index 66b9ddce98..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/java/weather/WeatherForecastClient.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 weather; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.PropertyException; - -import org.apache.tuscany.sca.node.Contribution; -import org.apache.tuscany.sca.node.ContributionLocationHelper; -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.NodeFactory; - -import com.example.weather.GetWeatherByZipCodeResponse; -import com.example.weather.WeatherForecastSoap; -import com.example.weather.WeatherForecasts; - -/** - * This client program to invoke the Mortgage LoanApproval service - */ -public class WeatherForecastClient { - - public static void main(String[] args) throws Exception { - - String location = ContributionLocationHelper.getContributionLocation(WeatherForecastImpl.class); - Node node = NodeFactory.newInstance().createNode("WeatherForecast.composite", new Contribution("c1", location)); - node.start(); - testJAXWS(node); - - node.stop(); - } - - static void testJAXWS(Node node) throws JAXBException, PropertyException { - WeatherForecastSoap weatherService = node.getService(WeatherForecastSoap.class, "WeatherForecastService"); - - WeatherForecasts result = weatherService.getWeatherByZipCode("94555"); - - // Dump the result as XML - - // Wrap the result so that it can be marshaled - GetWeatherByZipCodeResponse response = new GetWeatherByZipCodeResponse(); - response.setGetWeatherByZipCodeResult(result); - - // Marshal the JAXB object into XML - JAXBContext context = JAXBContext.newInstance(GetWeatherByZipCodeResponse.class); - StringWriter writer = new StringWriter(); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - marshaller.marshal(response, writer); - - String xml = writer.toString(); - System.out.println(xml); - } -} diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/META-INF/sca-contribution.xml deleted file mode 100644 index 5271f51784..0000000000 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/META-INF/sca-contribution.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - * 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. ---> -<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" - xmlns:w="http://weather"> - <deployable composite="w:WeatherForecast"/> -</contribution>
\ No newline at end of file diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/WeatherForecast.composite b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.composite index ff98e51c67..9f74fc5c09 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/WeatherForecast.composite +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.composite @@ -1,34 +1,39 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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.
--->
-<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
- targetNamespace="http://weather"
- name="WeatherForecast">
-
- <component name="WeatherForecastService">
- <implementation.java class="weather.WeatherForecastImpl" />
- <reference name="weatherForecast">
- <binding.ws wsdlElement="http://www.webservicex.net#wsdl.port(WeatherForecast/WeatherForecastSoap)" />
- </reference>
- <service name="WeatherForecastSoap">
- <binding.ws wsdlElement="http://www.webservicex.net#wsdl.port(WeatherForecast/WeatherForecastSoap)" />
- </service>
- </component>
-
-</composite>
+<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" + targetNamespace="http://www.tuscany.apache.org/tests/binding/ws/axis2" + name="wsdlbinding"> + + <component name="HelloWorldClient"> + <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.helloworld.HelloWorldClient"/> + <reference name="helloWorldWS"> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/> + </reference> + </component> + + <component name="HelloWorldService"> + <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.helloworld.HelloWorldService"/> + <service name="HelloWorld"> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/> + </service> + </component> + +</composite> diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.wsdl b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.wsdl new file mode 100644 index 0000000000..c5b59f1462 --- /dev/null +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/wsdlport/helloworld.wsdl @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="helloworld"> + + <wsdl:types> + <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema"> + + <element name="getGreetings"> + <complexType> + <sequence> + <element name="name" type="xsd:string"/> + </sequence> + </complexType> + </element> + + <element name="getGreetingsResponse"> + <complexType> + <sequence> + <element name="getGreetingsReturn" type="xsd:string"/> + </sequence> + </complexType> + </element> + + </schema> + </wsdl:types> + + <wsdl:message name="getGreetingsRequest"> + <wsdl:part element="tns:getGreetings" name="parameters"/> + </wsdl:message> + + <wsdl:message name="getGreetingsResponse"> + <wsdl:part element="tns:getGreetingsResponse" name="parameters"/> + </wsdl:message> + + <wsdl:portType name="HelloWorld"> + <wsdl:operation name="getGreetings"> + <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/> + <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/> + </wsdl:operation> + </wsdl:portType> + + <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld"> + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="getGreetings"> + <wsdlsoap:operation soapAction=""/> + <wsdl:input name="getGreetingsRequest"> + <wsdlsoap:body use="literal"/> + </wsdl:input> + <wsdl:output name="getGreetingsResponse"> + <wsdlsoap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + + </wsdl:binding> + + <wsdl:service name="HelloWorldService"> + <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort"> + <wsdlsoap:address location="http://localhost:8085/HelloWorldService/HelloWorld"/> + </wsdl:port> + </wsdl:service> + +</wsdl:definitions> |