You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2012/02/19 02:30:02 UTC
svn commit: r1290918 - in /openejb/trunk/openejb/examples/webservice-holder:
./ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/superbiz/ src/main/java/org/superbiz/ws/
src/main/java/org/superbiz/ws/out/ src/main/resources/ src/main/...
Author: dblevins
Date: Sun Feb 19 01:30:01 2012
New Revision: 1290918
URL: http://svn.apache.org/viewvc?rev=1290918&view=rev
Log:
TOMEE-140: Example: @WebService OUT params with @WebParam and JAX-WS Holder
Added:
openejb/trunk/openejb/examples/webservice-holder/
openejb/trunk/openejb/examples/webservice-holder/README.md
openejb/trunk/openejb/examples/webservice-holder/build.xml (with props)
openejb/trunk/openejb/examples/webservice-holder/pom.xml (with props)
openejb/trunk/openejb/examples/webservice-holder/src/
openejb/trunk/openejb/examples/webservice-holder/src/main/
openejb/trunk/openejb/examples/webservice-holder/src/main/java/
openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/
openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/
openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/
openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/
openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/Calculator.java (with props)
openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/CalculatorWs.java (with props)
openejb/trunk/openejb/examples/webservice-holder/src/main/resources/
openejb/trunk/openejb/examples/webservice-holder/src/main/resources/org/
openejb/trunk/openejb/examples/webservice-holder/src/main/resources/org/superbiz/
openejb/trunk/openejb/examples/webservice-holder/src/main/resources/org/superbiz/calculator/
openejb/trunk/openejb/examples/webservice-holder/src/main/resources/org/superbiz/calculator/ws/
openejb/trunk/openejb/examples/webservice-holder/src/test/
openejb/trunk/openejb/examples/webservice-holder/src/test/java/
openejb/trunk/openejb/examples/webservice-holder/src/test/java/org/
openejb/trunk/openejb/examples/webservice-holder/src/test/java/org/superbiz/
openejb/trunk/openejb/examples/webservice-holder/src/test/java/org/superbiz/ws/
openejb/trunk/openejb/examples/webservice-holder/src/test/java/org/superbiz/ws/out/
openejb/trunk/openejb/examples/webservice-holder/src/test/java/org/superbiz/ws/out/CalculatorTest.java (with props)
Added: openejb/trunk/openejb/examples/webservice-holder/README.md
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webservice-holder/README.md?rev=1290918&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webservice-holder/README.md (added)
+++ openejb/trunk/openejb/examples/webservice-holder/README.md Sun Feb 19 01:30:01 2012
@@ -0,0 +1,169 @@
+Title: @WebService OUT params with @WebParam and JAX-WS Holder
+
+With SOAP it is possible to return multiple values in a single request. This is impossible in Java as a method can only return one object.
+
+JAX-WS solves this problem with the concept of Holders. A `javax.xml.ws.Holder` is a simple wrapper object that can be passed into the `@WebService` method as a parameter. The application sets the value of the holder during the request and the server will send the value back as an OUT parameter.
+
+## Using @WebParam and javax.xml.ws.Holder
+
+The `@WebParam` annotation allows us to declare the `sum` and `multiply` Holders as `WebParam.Mode.OUT` parameters. As mentioned, these holders are simply empty buckets the application can fill in with data to have sent to the client. The server will pass them in uninitialized.
+
+ @Stateless
+ @WebService(
+ portName = "CalculatorPort",
+ serviceName = "CalculatorService",
+ targetNamespace = "http://superbiz.org/wsdl",
+ endpointInterface = "org.superbiz.ws.out.CalculatorWs")
+ public class Calculator implements CalculatorWs {
+
+ public void sumAndMultiply(int a, int b,
+ @WebParam(name = "sum", mode = WebParam.Mode.OUT) Holder<Integer> sum,
+ @WebParam(name = "multiply", mode = WebParam.Mode.OUT) Holder<Integer> multiply) {
+ sum.value = a + b;
+ multiply.value = a * b;
+ }
+ }
+
+If the Holders were specified as `WebParam.Mode.INOUT` params, then the client could use them to send data and the application as well. The `Holder` instances would then be initialized with the data from the client request. The application could check the data before eventually overriting it with the response values.
+
+## The WSDL
+
+The above JAX-WS `@WebService` component results in the folliwing WSDL that will be created automatically. Note the `sumAndMultiplyResponse` complext type returns two elements. These match the `@WebParam` declarations and our two `Holder<Integer>` params.
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ name="CalculatorService"
+ targetNamespace="http://superbiz.org/wsdl"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://superbiz.org/wsdl"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified"
+ targetNamespace="http://superbiz.org/wsdl"
+ xmlns:tns="http://superbiz.org/wsdl"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="sumAndMultiply" type="tns:sumAndMultiply"/>
+ <xsd:complexType name="sumAndMultiply">
+ <xsd:sequence>
+ <xsd:element name="arg0" type="xsd:int"/>
+ <xsd:element name="arg1" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="sumAndMultiplyResponse" type="tns:sumAndMultiplyResponse"/>
+ <xsd:complexType name="sumAndMultiplyResponse">
+ <xsd:sequence>
+ <xsd:element minOccurs="0" name="sum" type="xsd:int"/>
+ <xsd:element minOccurs="0" name="multiply" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="sumAndMultiplyResponse">
+ <wsdl:part element="tns:sumAndMultiplyResponse" name="parameters"/>
+ </wsdl:message>
+ <wsdl:message name="sumAndMultiply">
+ <wsdl:part element="tns:sumAndMultiply" name="parameters"/>
+ </wsdl:message>
+ <wsdl:portType name="CalculatorWs">
+ <wsdl:operation name="sumAndMultiply">
+ <wsdl:input message="tns:sumAndMultiply" name="sumAndMultiply"/>
+ <wsdl:output message="tns:sumAndMultiplyResponse" name="sumAndMultiplyResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CalculatorServiceSoapBinding" type="tns:CalculatorWs">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="sumAndMultiply">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="sumAndMultiply">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sumAndMultiplyResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CalculatorService">
+ <wsdl:port binding="tns:CalculatorServiceSoapBinding" name="CalculatorPort">
+ <soap:address location="http://127.0.0.1:4204/Calculator?wsdl"/>
+ </wsdl:port>
+ </wsdl:service>
+ </wsdl:definitions>
+
+## Testing the OUT params
+
+Here we see a JAX-WS client executing the `sumAndMultiply` operation. Two empty `Holder` instances are created and passed in as parameters. The data from the `sumAndMultiplyResponse` is placed in the `Holder` instances and is then available to the client after the operation completes.
+
+The holders themselves are not actually sent in the request unless they are configured as INOUT params via WebParam.Mode.INOUT on `@WebParam`
+
+ import org.junit.BeforeClass;
+ import org.junit.Test;
+
+ import javax.ejb.embeddable.EJBContainer;
+ import javax.xml.namespace.QName;
+ import javax.xml.ws.Holder;
+ import javax.xml.ws.Service;
+ import java.net.URL;
+ import java.util.Properties;
+
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.assertNotNull;
+
+ public class CalculatorTest {
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ Properties properties = new Properties();
+ properties.setProperty("openejb.embedded.remotable", "true");
+ properties.setProperty("httpejbd.print", "true");
+ properties.setProperty("httpejbd.indent.xml", "true");
+ EJBContainer.createEJBContainer(properties);
+ }
+
+ @Test
+ public void outParams() throws Exception {
+ final Service calculatorService = Service.create(
+ new URL("http://127.0.0.1:4204/Calculator?wsdl"),
+ new QName("http://superbiz.org/wsdl", "CalculatorService"));
+
+ assertNotNull(calculatorService);
+
+ final CalculatorWs calculator = calculatorService.getPort(CalculatorWs.class);
+
+ final Holder<Integer> sum = new Holder<Integer>();
+ final Holder<Integer> multiply = new Holder<Integer>();
+
+ calculator.sumAndMultiply(4, 6, sum, multiply);
+
+ assertEquals(10, (int) sum.value);
+ assertEquals(24, (int) multiply.value);
+ }
+ }
+
+
+## Inspecting the messages
+
+The above execution results in the following SOAP message.
+
+### SOAP sumAndMultiply <small>client request</small>
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns1:sumAndMultiply xmlns:ns1="http://superbiz.org/wsdl">
+ <arg0>4</arg0>
+ <arg1>6</arg1>
+ </ns1:sumAndMultiply>
+ </soap:Body>
+ </soap:Envelope>
+
+### SOAP sumAndMultiplyResponse <small>server response</small>
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns1:sumAndMultiplyResponse xmlns:ns1="http://superbiz.org/wsdl">
+ <sum>10</sum>
+ <multiply>24</multiply>
+ </ns1:sumAndMultiplyResponse>
+ </soap:Body>
+ </soap:Envelope>
Added: openejb/trunk/openejb/examples/webservice-holder/build.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webservice-holder/build.xml?rev=1290918&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webservice-holder/build.xml (added)
+++ openejb/trunk/openejb/examples/webservice-holder/build.xml Sun Feb 19 01:30:01 2012
@@ -0,0 +1,119 @@
+<?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.
+-->
+
+<!-- $Rev: 1237516 $ $Date: 2012-01-29 16:48:17 -0800 (Sun, 29 Jan 2012) $ -->
+
+<project name="MyProject" default="dist" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <!-- ===============================================================
+
+ HOW TO RUN
+
+ Download http://archive.apache.org/dist/maven/binaries/maven-ant-tasks-2.0.9.jar
+ Then execute ant as follows:
+
+ ant -lib maven-ant-tasks-2.0.9.jar
+
+ NOTE
+
+ You do NOT need maven-ant-tasks-2.0.9.jar to use OpenEJB for embedded EJB
+ testing with Ant. It is simply used in this example to make the build.xml
+ a bit simpler. As long as OpenEJB and it's required libraries are in the
+ <junit> classpath, the tests will run with OpenEJB embedded.
+
+ ================================================================= -->
+
+ <artifact:remoteRepository id="apache.snapshot.repository" url="http://repository.apache.org/snapshots/"/>
+ <artifact:remoteRepository id="m2.repository" url="http://repo1.maven.org/maven2/"/>
+
+ <!-- Build Classpath -->
+ <artifact:dependencies pathId="classpath.main">
+ <dependency groupId="org.apache.openejb" artifactId="javaee-api-embedded" version="6.0-3"/>
+ </artifact:dependencies>
+
+ <!-- Test Build Classpath -->
+ <artifact:dependencies pathId="classpath.test.build">
+ <dependency groupId="junit" artifactId="junit" version="4.3.1"/>
+ </artifact:dependencies>
+
+ <!-- Test Run Classpath -->
+ <artifact:dependencies pathId="classpath.test.run">
+ <remoteRepository refid="apache.snapshot.repository"/>
+ <remoteRepository refid="m2.repository"/>
+
+ <dependency groupId="org.apache.openejb" artifactId="openejb-cxf" version="4.0.0-beta-1"/>
+ <dependency groupId="junit" artifactId="junit" version="4.3.1"/>
+ </artifact:dependencies>
+
+ <!-- Properties -->
+
+ <property name="src.main.java" location="src/main/java"/>
+ <property name="src.main.resources" location="src/main/resources"/>
+ <property name="src.test.java" location="src/test/java"/>
+ <property name="build.main" location="target/classes"/>
+ <property name="build.test" location="target/test-classes"/>
+ <property name="test.reports" location="target/test-reports"/>
+ <property name="dist" location="target"/>
+
+
+ <target name="init">
+ <mkdir dir="${build.main}"/>
+ <mkdir dir="${build.test}"/>
+ <mkdir dir="${test.reports}"/>
+ </target>
+
+ <target name="compile" depends="init">
+
+ <javac srcdir="${src.main.java}" destdir="${build.main}">
+ <classpath refid="classpath.main"/>
+ </javac>
+ <copy todir="${build.main}">
+ <fileset dir="${src.main.resources}"/>
+ </copy>
+
+ <javac srcdir="${src.test.java}" destdir="${build.test}">
+ <classpath location="${build.main}"/>
+ <classpath refid="classpath.main"/>
+ <classpath refid="classpath.test.build"/>
+ </javac>
+ </target>
+
+ <target name="test" depends="compile">
+ <junit fork="yes" printsummary="yes">
+ <classpath location="${build.main}"/>
+ <classpath location="${build.test}"/>
+ <classpath refid="classpath.main"/>
+ <classpath refid="classpath.test.build"/>
+ <classpath refid="classpath.test.run"/>
+
+ <formatter type="plain"/>
+
+ <batchtest fork="yes" todir="${test.reports}">
+ <fileset dir="${src.test.java}">
+ <include name="**/*Test.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="dist" depends="test">
+ <jar jarfile="${dist}/myproject-1.0.jar" basedir="${build.main}"/>
+ </target>
+
+</project>
Propchange: openejb/trunk/openejb/examples/webservice-holder/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/examples/webservice-holder/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webservice-holder/pom.xml?rev=1290918&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webservice-holder/pom.xml (added)
+++ openejb/trunk/openejb/examples/webservice-holder/pom.xml Sun Feb 19 01:30:01 2012
@@ -0,0 +1,102 @@
+<?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.
+-->
+
+<!-- $Rev: 1237516 $ $Date: 2012-01-29 16:48:17 -0800 (Sun, 29 Jan 2012) $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.superbiz</groupId>
+ <artifactId>webservice-holder</artifactId>
+ <packaging>jar</packaging>
+ <version>1.1-SNAPSHOT</version>
+ <name>OpenEJB :: Examples :: @WebService Holder</name>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>apache-m2-snapshot</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://repository.apache.org/snapshots</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>6.0-3</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <!--
+ The <scope>test</scope> guarantees that non of your runtime
+ code is dependent on any OpenEJB classes.
+ -->
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-cxf</artifactId>
+ <version>4.0.0-beta-3-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- This is required on IBM JDKs (and potentially others) because saaj-impl depends
+ on Sun's internal copy of Xerces. See OPENEJB-1126. -->
+ <dependency>
+ <groupId>com.sun.xml.parsers</groupId>
+ <artifactId>jaxp-ri</artifactId>
+ <version>1.4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <!--
+ This section allows you to configure where to publish libraries for sharing.
+ It is not required and may be deleted. For more information see:
+ http://maven.apache.org/plugins/maven-deploy-plugin/
+ -->
+ <distributionManagement>
+ <repository>
+ <id>localhost</id>
+ <url>file://${basedir}/target/repo/</url>
+ </repository>
+ <snapshotRepository>
+ <id>localhost</id>
+ <url>file://${basedir}/target/snapshot-repo/</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+</project>
Propchange: openejb/trunk/openejb/examples/webservice-holder/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/Calculator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/Calculator.java?rev=1290918&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/Calculator.java (added)
+++ openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/Calculator.java Sun Feb 19 01:30:01 2012
@@ -0,0 +1,38 @@
+/**
+ * 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.superbiz.ws.out;
+
+import javax.ejb.Stateless;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+
+@Stateless
+@WebService(
+ portName = "CalculatorPort",
+ serviceName = "CalculatorService",
+ targetNamespace = "http://superbiz.org/wsdl",
+ endpointInterface = "org.superbiz.ws.out.CalculatorWs")
+public class Calculator implements CalculatorWs {
+
+ public void sumAndMultiply(int a, int b,
+ @WebParam(name = "sum", mode = WebParam.Mode.OUT) Holder<Integer> sum,
+ @WebParam(name = "multiply", mode = WebParam.Mode.OUT) Holder<Integer> multiply) {
+ sum.value = a + b;
+ multiply.value = a * b;
+ }
+}
Propchange: openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/Calculator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/CalculatorWs.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/CalculatorWs.java?rev=1290918&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/CalculatorWs.java (added)
+++ openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/CalculatorWs.java Sun Feb 19 01:30:01 2012
@@ -0,0 +1,26 @@
+/**
+ * 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.superbiz.ws.out;
+
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+
+@WebService(targetNamespace = "http://superbiz.org/wsdl")
+public interface CalculatorWs {
+
+ public void sumAndMultiply(int a, int b, Holder<Integer> sum, Holder<Integer> multiply);
+}
Propchange: openejb/trunk/openejb/examples/webservice-holder/src/main/java/org/superbiz/ws/out/CalculatorWs.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: openejb/trunk/openejb/examples/webservice-holder/src/test/java/org/superbiz/ws/out/CalculatorTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/webservice-holder/src/test/java/org/superbiz/ws/out/CalculatorTest.java?rev=1290918&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/webservice-holder/src/test/java/org/superbiz/ws/out/CalculatorTest.java (added)
+++ openejb/trunk/openejb/examples/webservice-holder/src/test/java/org/superbiz/ws/out/CalculatorTest.java Sun Feb 19 01:30:01 2012
@@ -0,0 +1,61 @@
+/**
+ * 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.superbiz.ws.out;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
+import javax.xml.ws.Service;
+import java.net.URL;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class CalculatorTest {
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ Properties properties = new Properties();
+ properties.setProperty("openejb.embedded.remotable", "true");
+ // properties.setProperty("httpejbd.print", "true");
+ // properties.setProperty("httpejbd.indent.xml", "true");
+ EJBContainer.createEJBContainer(properties);
+ }
+
+ @Test
+ public void outParams() throws Exception {
+ final Service calculatorService = Service.create(
+ new URL("http://127.0.0.1:4204/Calculator?wsdl"),
+ new QName("http://superbiz.org/wsdl", "CalculatorService"));
+
+ assertNotNull(calculatorService);
+
+ final CalculatorWs calculator = calculatorService.getPort(CalculatorWs.class);
+
+ final Holder<Integer> sum = new Holder<Integer>();
+ final Holder<Integer> multiply = new Holder<Integer>();
+
+ calculator.sumAndMultiply(4, 6, sum, multiply);
+
+ assertEquals(10, (int) sum.value);
+ assertEquals(24, (int) multiply.value);
+ }
+}
Propchange: openejb/trunk/openejb/examples/webservice-holder/src/test/java/org/superbiz/ws/out/CalculatorTest.java
------------------------------------------------------------------------------
svn:eol-style = native