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 ro...@apache.org on 2008/03/26 22:31:54 UTC
svn commit: r641584 [1/2] - in /webservices/axis2/trunk/java/modules:
jaxws-integration/ jaxws-integration/test-resources/wsdl/
jaxws-integration/test/org/apache/axis2/jaxws/sample/
jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/ jaxw...
Author: rott
Date: Wed Mar 26 14:31:52 2008
New Revision: 641584
URL: http://svn.apache.org/viewvc?rev=641584&view=rev
Log:
New jaxws-integration tests, to be used and enhanced for async testing
Added:
webservices/axis2/trunk/java/modules/jaxws-integration/test-resources/wsdl/async_doclitwr2.wsdl
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncClient.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncPort.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncService.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/ThrowExceptionFault.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/common/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/common/CallbackHandler.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/AsyncPort.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/DocLitWrappedPortImpl.java
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/MANIFEST.MF
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/async_doclitwr2.wsdl
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/ThrowExceptionFault.java
Modified:
webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml?rev=641584&r1=641583&r2=641584&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml Wed Mar 26 14:31:52 2008
@@ -277,6 +277,12 @@
<classpath location="${compiled.classes.dir}"/>
<arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/async_doclitwr.wsdl"/>
</java>
+ <echo>Generating java from async_doclitwr2.wsdl</echo>
+ <java classname="com.sun.tools.xjc.Driver" fork="true">
+ <classpath refid="maven.runtime.classpath"/>
+ <classpath location="${compiled.classes.dir}"/>
+ <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/async_doclitwr2.wsdl"/>
+ </java>
<echo>Generating java from FaultyWebService.wsdl</echo>
<java classname="com.sun.tools.xjc.Driver" fork="true">
<classpath refid="maven.runtime.classpath"/>
@@ -964,6 +970,23 @@
/>
<delete dir="target/test-classes/servicejars/AsyncService"/>
+ <copy toDir="target/test-classes/servicejars/AsyncService2/">
+ <fileset dir="target/test-classes">
+ <include name="org/apache/axis2/jaxws/sample/asyncdoclit/**"/>
+ <exclude
+ name="org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/services.xml"/>
+ </fileset>
+ <fileset dir="test/org/apache/axis2/jaxws/sample/asyncdoclit/server">
+ <include name="META-INF/**"/>
+ <exclude name="META-INF/services.xml"/>
+ </fileset>
+ </copy>
+
+ <zip destfile="target/test-classes/servicejars/AsyncService2.jar"
+ basedir="${pom.basedir}/target/test-classes/servicejars/AsyncService2"
+ />
+ <delete dir="target/test-classes/servicejars/AsyncService2"/>
+
<copy toDir="target/test-classes/servicejars/FaultyWebServiceService/">
<fileset dir="target/test-classes">
<include name="org/apache/axis2/jaxws/sample/faults/**"/>
@@ -1223,6 +1246,7 @@
<!-- Enable the next 2 lines if you want to attach a debugger
<argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006</argLine>-->
<includes>
+
<include>**/MultiRedirectionCatalogTest.java</include>
<include>**/DispatchSoapActionTest.java</include>
<include>**/ProxySoapActionTest.java</include>
@@ -1231,6 +1255,7 @@
<include>**/ProxyMTOMFeatureTest.java</include>
<include>**/SOAP12DispatchTest.java</include>
<include>**/JAXBContextTest.java</include>
+
<include>**/StringProviderTests.java</include>
<include>**/SOAPFaultProviderTests.java</include>
<include>**/StringMessageProviderTests.java</include>
@@ -1250,7 +1275,6 @@
<include>**/MtomSampleTests.java</include>
<include>**/JAXBProviderTests.java</include>
<include>**/BareTests.java</include>
-
<include>**/AddNumbersHandlerTests.java</include>
<include>**/AddNumbersTests.java</include>
<include>**/DLWMinTests.java</include>
@@ -1289,6 +1313,7 @@
<include>**/FaultyWebServiceTests.java</include>
<include>**/ParallelAsyncTests.java</include>
<include>**/SWAMTOMTests.java</include>
+ <include>**/RuntimeExceptionsAsyncMepTest.java</include>
</includes>
<systemProperties>
<property>
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test-resources/wsdl/async_doclitwr2.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test-resources/wsdl/async_doclitwr2.wsdl?rev=641584&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test-resources/wsdl/async_doclitwr2.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test-resources/wsdl/async_doclitwr2.wsdl Wed Mar 26 14:31:52 2008
@@ -0,0 +1,400 @@
+<?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 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://org/test/asyncdoclit"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="async"
+ targetNamespace="http://org/test/asyncdoclit">
+
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://org/test/asyncdoclit"
+ xmlns:tns="http://org/test/asyncdoclit"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="ping">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="message" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="pingResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="sleep">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="message" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="sleepResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="message" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="isAsleep">
+ <xsd:complexType />
+ </xsd:element>
+
+ <xsd:element name="isAsleepResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="message" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="wakeUp">
+ <xsd:complexType />
+ </xsd:element>
+
+ <xsd:element name="wakeUpResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="message" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="invokeAsync">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="request" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="invokeAsyncResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="customAsync">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="request" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="customAsyncResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="another">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="request" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="anotherResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="throwException">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="exceptionType" type="tns:ExceptionTypeEnum" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:simpleType name="ExceptionTypeEnum">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="NPE" />
+ <xsd:enumeration value="DivideByZero" />
+ <xsd:enumeration value="WSE" />
+ <xsd:enumeration value="SoapFault" />
+ <xsd:enumeration value="WsdlFault" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:element name="throwExceptionFaultBean">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="text" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="throwExceptionResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ </xsd:schema>
+ </wsdl:types>
+
+ <wsdl:message name="pingRequest">
+ <wsdl:part name="request" element="tns:ping" />
+ </wsdl:message>
+
+ <wsdl:message name="pingResponse">
+ <wsdl:part name="response" element="tns:pingResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="throwExceptionRequest">
+ <wsdl:part name="request" element="tns:throwException" />
+ </wsdl:message>
+
+ <wsdl:message name="throwExceptionResponse">
+ <wsdl:part name="response" element="tns:throwExceptionResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="throwExceptionFault">
+ <wsdl:part name="fault" element="tns:throwExceptionFaultBean" />
+ </wsdl:message>
+
+ <wsdl:message name="sleepRequest">
+ <wsdl:part name="request" element="tns:sleep" />
+ </wsdl:message>
+
+ <wsdl:message name="sleepResponse">
+ <wsdl:part name="response" element="tns:sleepResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="wakeUpRequest">
+ <wsdl:part name="response" element="tns:wakeUp" />
+ </wsdl:message>
+
+ <wsdl:message name="wakeUpResponse">
+ <wsdl:part name="response" element="tns:wakeUpResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="isAsleepRequest">
+ <wsdl:part name="response" element="tns:isAsleep" />
+ </wsdl:message>
+
+ <wsdl:message name="isAsleepResponse">
+ <wsdl:part name="response" element="tns:isAsleepResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="invokeAsyncRequest">
+ <wsdl:part name="request" element="tns:invokeAsync" />
+ </wsdl:message>
+
+ <wsdl:message name="invokeAsyncResponse">
+ <wsdl:part name="response" element="tns:invokeAsyncResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="customAsyncRequest">
+ <wsdl:part name="request" element="tns:customAsync" />
+ </wsdl:message>
+
+ <wsdl:message name="customAsyncResponse">
+ <wsdl:part name="response" element="tns:customAsyncResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="anotherRequest">
+ <wsdl:part name="request" element="tns:another" />
+ </wsdl:message>
+
+ <wsdl:message name="anotherResponse">
+ <wsdl:part name="response" element="tns:anotherResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AsyncPort">
+
+ <!-- simple ping operation that will be used for DocLitWrapped async test-->
+ <wsdl:operation name="ping">
+ <wsdl:input message="tns:pingRequest" />
+ <wsdl:output message="tns:pingResponse" />
+ </wsdl:operation>
+
+ <!-- request for the server to goto sleep until release is called-->
+ <wsdl:operation name="sleep">
+ <wsdl:input message="tns:sleepRequest" />
+ <wsdl:output message="tns:sleepResponse" />
+ </wsdl:operation>
+
+ <!-- check to see if the sleep operation has been called yet -->
+ <wsdl:operation name="isAsleep">
+ <wsdl:input message="tns:isAsleepRequest" />
+ <wsdl:output message="tns:isAsleepResponse" />
+ </wsdl:operation>
+
+ <!-- force the sleep operation to stop sleeping -->
+ <wsdl:operation name="wakeUp">
+ <wsdl:input message="tns:wakeUpRequest" />
+ <wsdl:output message="tns:wakeUpResponse" />
+ </wsdl:operation>
+
+
+
+ <!-- Second suite of tests for Async operation naming:
+ will test for how the implementation responds to
+ methods ending in Async with async binding enabled
+ -->
+ <wsdl:operation name="invokeAsync">
+ <wsdl:input message="tns:invokeAsyncRequest" />
+ <wsdl:output message="tns:invokeAsyncResponse" />
+ </wsdl:operation>
+
+ <!-- will test for how the implementation responds to
+ methods ending in async with async binding enabled
+ -->
+ <wsdl:operation name="customAsync">
+ <wsdl:input message="tns:customAsyncRequest" />
+ <wsdl:output message="tns:customAsyncResponse" />
+ </wsdl:operation>
+
+ <!-- we will map this operation to a java method ending in Async
+ -->
+ <wsdl:operation name="another">
+ <wsdl:input message="tns:anotherRequest" />
+ <wsdl:output message="tns:anotherResponse" />
+ </wsdl:operation>
+
+ <!-- test for varios exceptions, to test exception handling with asyncMEP
+ enabled
+ -->
+ <wsdl:operation name="throwException">
+ <wsdl:input message="tns:throwExceptionRequest" />
+ <wsdl:output message="tns:throwExceptionResponse" />
+ <wsdl:fault name="throwExceptionFault" message="tns:throwExceptionFault" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="Async" type="tns:AsyncPort">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="ping">
+ <soap:operation soapAction="http://org/test/asyncdoclit/ping" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sleep">
+ <soap:operation soapAction="http://org/test/asyncdoclit/sleep" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="isAsleep">
+ <soap:operation soapAction="http://org/test/asyncdoclit/isAsleep" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="wakeUp">
+ <soap:operation soapAction="http://org/test/asyncdoclit/wakeUp" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="invokeAsync">
+ <soap:operation soapAction="http://org/test/asyncdoclit/invokeAsync" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="customAsync">
+ <soap:operation soapAction="http://org/test/asyncdoclit/customAsync" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="another">
+ <soap:operation soapAction="http://org/test/asyncdoclit/another" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="throwException">
+ <soap:operation soapAction="http://org/test/asyncdoclit/throwException" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="throwExceptionFault">
+ <soap:fault use="literal" name="throwExceptionFault" />
+ </wsdl:fault>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="AsyncService">
+ <wsdl:port binding="tns:Async" name="AsyncPort">
+ <soap:address location="http://localhost:9080/jaxws.asyncdoclit/services/AsyncDocLitWrappedService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java?rev=641584&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java Wed Mar 26 14:31:52 2008
@@ -0,0 +1,326 @@
+//
+// @(#) 1.4 FVT/ws/code/websvcs.fvt/src/jaxws/async/wsfvt/test/asyncmep/RuntimeExceptionsAsyncMepTest.java, WAS.websvcs.fvt, WASX.FVT 2/16/07 12:00:23 [7/11/07 13:14:36]
+//
+// IBM Confidential OCO Source Material
+// (C) COPYRIGHT International Business Machines Corp. 2006
+// The source code for this program is not published or otherwise divested
+// of its trade secrets, irrespective of what has been deposited with the
+// U.S. Copyright Office.
+//
+// Change History:
+// Date UserId Defect Description
+// ----------------------------------------------------------------------------
+// 01/10/07 sedov 413290 New File
+// 02/07/07 sedov 419445 Update callback tests to use handler
+// 02/16/07 sedov 420835 Updated WSDL Fault test
+
+package org.apache.axis2.jaxws.sample;
+
+import java.net.UnknownHostException;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Response;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.Addressing;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.jaxws.sample.asyncdoclit.client.AsyncClient;
+import org.apache.axis2.jaxws.sample.asyncdoclit.client.AsyncPort;
+import org.apache.axis2.jaxws.sample.asyncdoclit.client.AsyncService;
+import org.apache.axis2.jaxws.sample.asyncdoclit.common.CallbackHandler;
+import org.apache.axis2.jaxws.sample.asyncdoclit.client.ThrowExceptionFault;
+import org.test.asyncdoclit.ExceptionTypeEnum;
+import org.test.asyncdoclit.ThrowExceptionResponse;
+
+/**
+ * Test for varios async exceptions whern AsyncMEP is enabled
+ */
+public class RuntimeExceptionsAsyncMepTest extends AbstractTestCase { //com.ibm.ws.wsfvt.test.framework.FVTTestCase {
+
+ private static final String DOCLITWR_ASYNC_ENDPOINT =
+ "http://localhost:6060/axis2/services/AsyncService2.DocLitWrappedPortImplPort";
+
+ private static final String ASYNC_MEP_PROPERTY = AsyncClient.ASYNC_MEP_PROPERTY;
+
+ static final String CONNECT_404_ENDPOINT = DOCLITWR_ASYNC_ENDPOINT //Constants.DOCLITWR_ASYNC_ENDPOINT
+ + "/DoesNotExist";
+
+ static final String HOST_NOT_FOUND_ENDPOINT = "http://this.endpoint.does.not.exist/nope";
+
+ public static Test suite() {
+ return getTestSetup(new TestSuite(RuntimeExceptionsAsyncMepTest.class));
+ }
+
+ private AsyncPort getPort() {
+
+ AsyncService service = new AsyncService();
+ AsyncPort port = service.getAsyncPort();
+ assertNotNull("Port is null", port);
+
+ Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
+ rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ DOCLITWR_ASYNC_ENDPOINT);
+
+ return port;
+ }
+
+ /**
+ * @testStrategy Invoke the proxy with async-polling method, the proxy is
+ * configured against an endpoint which does not exist (this
+ * is a server not found case). Expected to throw a
+ * EE/WSE/UnknownHostException
+ */
+ public void _testAsyncPolling_asyncMEP_UnknwonHost() throws Exception {
+
+ AsyncPort port = getPort();
+
+ Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
+ rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ HOST_NOT_FOUND_ENDPOINT);
+
+ Response<ThrowExceptionResponse> resp = port.throwExceptionAsync(ExceptionTypeEnum.WSE);
+
+ AsyncClient.waitBlocking(resp);
+ try {
+ resp.get();
+
+ fail("ExecutionException expected at invoke time when an invalid endpoint address is specified");
+ } catch (ExecutionException ee) {
+ //Constants.logStack(ee);
+
+ assertTrue("EE.getCause must be WebServiceException", ee.getCause() instanceof WebServiceException);
+
+ assertTrue("WSE.getCause must be UnknownHostException", checkStack(ee, UnknownHostException.class));
+ }
+ }
+
+ /**
+ * @testStrategy Invoke the proxy with async-polling method, the proxy is
+ * configured against an endpoint which does not exist (this
+ * is a 404-Not Found case). Expected to throw a EE/WSE
+ */
+ public void _testAsyncPolling_asyncMEP_404NotFound() throws Exception {
+
+ AsyncPort port = getPort();
+ Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
+ rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, CONNECT_404_ENDPOINT);
+ Response<ThrowExceptionResponse> resp = port.throwExceptionAsync(ExceptionTypeEnum.WSE);
+
+ AsyncClient.waitBlocking(resp);
+ try {
+ resp.get();
+
+ fail("ExecutionException expected at invoke time when an invalid endpoint address is specified");
+ } catch (ExecutionException ee) {
+ //Constants.logStack(ee);
+
+ assertTrue("EE.getCause must be WebServiceException",
+ ee.getCause() instanceof WebServiceException);
+
+ /*
+ * TODO: REVIEW. Original test was written expecting a 404 from the bad URL set on the requestcontext.
+ * However, this test actually does make it to the endpoint, and returns the exception specified in
+ * the call to port.throwExceptionAsync(ExceptionTypeEnum.WSE) above...so the assert is commented until
+ * we can review it. Also, different servers may behave differently, depending on how they want to
+ * parse the incoming request URL.
+ */
+ //assertTrue("WSE.getCause must be 404", checkStack(ee, java.net.ConnectException.class));
+ }
+ }
+
+ /**
+ * @testStrategy Invoke the proxy with async-polling method, the endpoint
+ * will throw a WSE which should result in a
+ * EE/SOAPFaultException
+ */
+ public void _testAsyncPolling_asyncMEP_WebServiceException() throws Exception {
+
+ AsyncPort port = getPort();
+ Response<ThrowExceptionResponse> resp = port
+ .throwExceptionAsync(ExceptionTypeEnum.WSE);
+
+ AsyncClient.waitBlocking(resp);
+ try {
+ resp.get();
+ fail("ExecutionException expected at Response.get when ednpoint throws an exception");
+ } catch (ExecutionException ee) {
+ //Constants.logStack(ee);
+
+ assertTrue(
+ "ExecutionException.getCause should be an instance of SOAPFaultException",
+ ee.getCause() instanceof SOAPFaultException);
+ }
+ }
+
+ /**
+ * @testStrategy Invoke the proxy with async-polling method, the endpoint
+ * will throw a wsdl:fault which should result in a
+ * EE/SimpleFault
+ */
+ public void _testAsyncPolling_asyncMEP_WsdlFault() throws Exception{
+
+ AsyncPort port = getPort();
+ Response<ThrowExceptionResponse> resp = port
+ .throwExceptionAsync(ExceptionTypeEnum.WSDL_FAULT);
+
+ AsyncClient.waitBlocking(resp);
+ try {
+ resp.get();
+ fail("ExecutionException expected at Response.get when ednpoint throws an exception");
+ } catch (ExecutionException ee) {
+ //Constants.logStack(ee);
+
+ assertTrue(
+ "ExecutionException.getCause should be an instance of SimpleFault",
+ ee.getCause() instanceof ThrowExceptionFault);
+ }
+ }
+
+ /** ******************** Async Callback ******************* */
+
+ /**
+ * @testStrategy Invoke the proxy with async-callback method, the proxy is
+ * configured against an endpoint which does not exist (this
+ * is a server not found case). Expected to throw a
+ * EE/WSE/UnknownHostException
+ */
+ public void _testAsyncCallback_asyncMEP_UnknownHost() throws Exception {
+
+ AsyncPort port = getPort();
+ Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
+ rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ HOST_NOT_FOUND_ENDPOINT);
+
+ CallbackHandler<ThrowExceptionResponse> handler = new CallbackHandler<ThrowExceptionResponse>();
+ Future<?> resp = port.throwExceptionAsync(ExceptionTypeEnum.WSE, handler);
+
+ AsyncClient.waitBlocking(resp);
+ try {
+ handler.get();
+
+ fail("ExecutionException expected at invoke time when an invalid endpoint address is specified");
+ } catch (ExecutionException ee) {
+ //Constants.logStack(ee);
+
+ assertTrue(
+ "ExecutionException.getCause should be an instance of WebServiceException",
+ ee.getCause() instanceof WebServiceException);
+
+ assertTrue("WSE.getCause must be UnknownHostException", checkStack(ee, UnknownHostException.class));
+
+ }
+ }
+
+ /**
+ * @testStrategy Invoke the proxy with async-callback method, the proxy is
+ * configured against an endpoint which does not exist (this
+ * is a 404 Not Found case). Expected to throw a
+ * EE/WSE/UnknownHostException
+ */
+ public void _testAsyncCallback_asyncMEP_404NotFound() throws Exception {
+
+ AsyncPort port = getPort();
+ Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
+ rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, CONNECT_404_ENDPOINT);
+
+ CallbackHandler<ThrowExceptionResponse> handler = new CallbackHandler<ThrowExceptionResponse>();
+ Future<?> resp = port.throwExceptionAsync(ExceptionTypeEnum.WSE, handler);
+
+ AsyncClient.waitBlocking(resp);
+ try {
+ handler.get();
+
+ fail("ExecutionException expected at Response.get when ednpoint throws an exception");
+ } catch (ExecutionException ee) {
+ //Constants.logStack(ee);
+
+ assertTrue(
+ "ExecutionException.getCause should be an instance of WebServiceException",
+ ee.getCause() instanceof WebServiceException);
+
+ /*
+ * TODO: REVIEW. Original test was written expecting a 404 from the bad URL set on the requestcontext.
+ * However, this test actually does make it to the endpoint, and returns the exception specified in
+ * the call to port.throwExceptionAsync(ExceptionTypeEnum.WSE) above...so the assert is commented until
+ * we can review it. Also, different servers may behave differently, depending on how they want to
+ * parse the incoming request URL.
+ */
+ //assertTrue("WSE.getCause should be an instance of ConnectException", checkStack(ee, java.nio.channels.UnresolvedAddressException.class));
+ }
+ }
+
+ /**
+ * @testStrategy Invoke the proxy with async-callback method, the proxy
+ * throws a generic WebServiceException
+ */
+ public void testAsyncCallback_asyncMEP_WebServiceException() throws Exception {
+
+ AsyncPort port = getPort();
+
+ Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
+ rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ DOCLITWR_ASYNC_ENDPOINT);
+ rc.put(AddressingConstants.WSA_REPLY_TO, "blarg");
+
+ CallbackHandler<ThrowExceptionResponse> handler = new CallbackHandler<ThrowExceptionResponse>();
+ Future<?> resp = port.throwExceptionAsync(ExceptionTypeEnum.WSE, handler);
+
+ AsyncClient.waitBlocking(resp);
+ try {
+ handler.get();
+
+ fail("ExecutionException expected at Response.get when ednpoint throws an exception");
+ } catch (ExecutionException ee) {
+ //Constants.logStack(ee);
+
+ assertTrue(
+ "ExecutionException.getCause should be an instance of WebServiceException",
+ ee.getCause() instanceof SOAPFaultException);
+ }
+ }
+
+ /**
+ * @testStrategy Invoke the proxy with async-callback method, the endpoint
+ * will throw a wsdl:fault which should result in a
+ * EE/SimpleFault
+ */
+ public void _testAsyncCallback_asyncMEP_WsdlFault() throws Exception{
+
+ AsyncPort port = getPort();
+ CallbackHandler<ThrowExceptionResponse> handler = new CallbackHandler<ThrowExceptionResponse>();
+ Future<?> resp = port.throwExceptionAsync(ExceptionTypeEnum.WSDL_FAULT, handler);
+
+ AsyncClient.waitBlocking(resp);
+
+ try {
+ handler.get();
+
+ fail("ExecutionException expected at Response.get when ednpoint throws an exception");
+ } catch (ExecutionException ee) {
+ //Constants.logStack(ee);
+
+ assertTrue(
+ "ExecutionException.getCause should be an instance of SimpleFault",
+ ee.getCause() instanceof ThrowExceptionFault);
+ }
+ }
+
+ private static boolean checkStack(Throwable t, Class find){
+ Throwable cur = t;
+ boolean found = false;
+ do {
+ found = cur.getClass().isAssignableFrom(find);
+ cur = cur.getCause();
+ } while (!found && cur != null);
+
+ return found;
+ }
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncClient.java?rev=641584&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncClient.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncClient.java Wed Mar 26 14:31:52 2008
@@ -0,0 +1,146 @@
+//
+// @(#) 1.3 FVT/ws/code/websvcs.fvt/src/jaxws/async/wsfvt/test/AsyncClient.java, WAS.websvcs.fvt, WASX.FVT 5/15/07 09:07:54 [7/11/07 13:14:36]
+//
+// IBM Confidential OCO Source Material
+// (C) COPYRIGHT International Business Machines Corp. 2006
+// The source code for this program is not published or otherwise divested
+// of its trade secrets, irrespective of what has been deposited with the
+// U.S. Copyright Office.
+//
+// Change History:
+// Date UserId Defect Description
+// ----------------------------------------------------------------------------
+// 05/11/07 sedov 438719 Added more trace
+// 05/15/07 sedov 439294 Added timer to isAsleepCheck
+package org.apache.axis2.jaxws.sample.asyncdoclit.client;
+
+import java.util.Map;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeoutException;
+
+import javax.xml.ws.BindingProvider;
+
+public class AsyncClient {
+
+ private static final String DOCLITWR_ASYNC_ENDPOINT =
+ "http://localhost:6060/axis2/services/AsyncService2.DocLitWrappedPortImplPort";
+
+ public static final String ASYNC_MEP_PROPERTY = "com.ibm.websphere.webservices.use.async.mep";
+
+ private static final int max_isasleep_check = 20000;
+
+ /**
+ * Auxiliary method used for doiing isAsleep checks. Will perform isAsleep
+ * up to a MAX_ISASLEEP_CHECK number of checks. Will sleep for
+ * SLEEP_ISASLEEP_SEC seconds in between requests. If reaches maximum number
+ * fo retries then will fail the test
+ */
+ public static boolean isAsleepCheck(String MESSAGE, AsyncPort port) throws Exception {
+ boolean asleep = false;
+ int check = 5; //Constants.MAX_ISASLEEP_CHECK;
+ String msg = null;
+
+ final long start = System.currentTimeMillis();
+
+ System.out.println("AsyncClient.isAsleepCheck(" + MESSAGE + ") Enter");
+
+ do {
+ try {
+ msg = port.isAsleep();
+ } catch (Exception e){
+ System.out.println("AsyncClient.isAsleepCheck Exception on isAsleep:" + e);
+ throw e;
+ }
+
+ asleep = (msg != null);
+
+ // fail the test if we ran out of checks
+ if ((check--) == 0) {
+ System.out.println("AsyncClient.isAsleepCheck=" + asleep
+ + " after " + (/*Constants.MAX_ISASLEEP_CHECK*/ max_isasleep_check - check)
+ + " tries");
+ throw new RuntimeException("Server did not receive sleep after several retries");
+ }
+
+ // sleep for a bit
+ try {
+ Thread.sleep(/*Constants.SLEEP_ISASLEEP_SEC*/ 1 * 1000);
+ } catch (InterruptedException e) {
+ System.out.println("AsyncClient.isAsleepCheck (ignored error) "
+ + e);
+ }
+
+ } while (!asleep);
+
+ System.out.println("AsyncClient.isAsleepCheck() asleep=" + asleep + " after "
+ + (/*Constants.MAX_ISASLEEP_CHECK*/ max_isasleep_check - check) + " tries");
+
+ if (asleep) {
+ System.out.println("AsyncClient.isAsleepCheck sleeping on:" + msg);
+ if (!MESSAGE.equals(msg)) {
+ throw new RuntimeException("Sleeping on an incorrect message");
+ }
+ }
+
+ long mins = (System.currentTimeMillis() - start) / 1000;
+ System.out.println("AsyncClient.isAsleepCheck() Exit, time=" + mins + "min");
+
+ return true;
+ }
+
+ /**
+ * Auxiliary method used for obtaining a proxy pre-configured with a
+ * specific Executor
+ */
+ public static AsyncPort getPort(Executor ex) {
+ AsyncService service = new AsyncService();
+
+ if (ex != null) service.setExecutor(ex);
+
+ AsyncPort port = service.getAsyncPort();
+ if (port == null) {
+ throw new RuntimeException("service.getAsyncPort() is null");
+ }
+
+ Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
+ rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ DOCLITWR_ASYNC_ENDPOINT); //Constants.DOCLITWR_ASYNC_ENDPOINT);
+
+ System.out.println("AsyncClient.getPort() = "
+ + DOCLITWR_ASYNC_ENDPOINT); //Constants.DOCLITWR_ASYNC_ENDPOINT);
+
+ return port;
+ }
+
+ /**
+ * Auxiliary method used to wait for a monitor for a certain amount of time
+ * before timing out
+ *
+ * @param monitor
+ */
+ public static void waitBlocking(Future<?> monitor) throws Exception {
+
+ System.out.println("AsyncClient.waitBlocking() Enter");
+
+ // wait for request to complete
+ int sec = /*Constants.CLIENT_MAX_SLEEP_SEC*/ max_isasleep_check;
+ while (!monitor.isDone() && !monitor.isCancelled()) {
+ Thread.sleep(1000);
+ sec--;
+ if (sec <= 0) break;
+ }
+
+ if (sec <= 0) {
+ System.out.println("AsyncClient.waitBlocking Exit, timeout after"
+ + /*Constants.CLIENT_MAX_SLEEP_SEC*/ max_isasleep_check + " sec");
+
+ throw new TimeoutException(
+ "Stopped waiting for Async response after "
+ + /*Constants.CLIENT_MAX_SLEEP_SEC*/ max_isasleep_check + " sec");
+ } else {
+ System.out.println("AsyncClient.waitBlocking Exit, " + sec
+ + "sec remaining");
+ }
+ }
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncPort.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncPort.java?rev=641584&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncPort.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncPort.java Wed Mar 26 14:31:52 2008
@@ -0,0 +1,312 @@
+//
+// Generated By:JAX-WS RI IBM 2.1.1 in JDK 6 (JAXB RI IBM JAXB 2.1.3 in JDK 1.6)
+//
+
+
+package org.apache.axis2.jaxws.sample.asyncdoclit.client;
+
+import java.util.concurrent.Future;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Holder;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.Response;
+import javax.xml.ws.ResponseWrapper;
+
+import org.test.asyncdoclit.AnotherResponse;
+import org.test.asyncdoclit.CustomAsyncResponse;
+import org.test.asyncdoclit.ExceptionTypeEnum;
+import org.test.asyncdoclit.InvokeAsyncResponse;
+import org.test.asyncdoclit.PingResponse;
+import org.test.asyncdoclit.SleepResponse;
+import org.test.asyncdoclit.ThrowExceptionResponse;
+
+@WebService(name = "AsyncPort", targetNamespace = "http://org/test/asyncdoclit")
+public interface AsyncPort {
+
+
+ /**
+ *
+ * @param message
+ * @return
+ * returns javax.xml.ws.Response<org.test.asyncdoclit.PingResponse>
+ */
+ @WebMethod(operationName = "ping", action = "ping")
+ @RequestWrapper(localName = "ping", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Ping")
+ @ResponseWrapper(localName = "pingResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.PingResponse")
+ public Response<PingResponse> pingAsync(
+ @WebParam(name = "message", targetNamespace = "")
+ String message);
+
+ /**
+ *
+ * @param message
+ * @param asyncHandler
+ * @return
+ * returns java.util.concurrent.Future<? extends java.lang.Object>
+ */
+ @WebMethod(operationName = "ping", action = "ping")
+ @RequestWrapper(localName = "ping", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Ping")
+ @ResponseWrapper(localName = "pingResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.PingResponse")
+ public Future<?> pingAsync(
+ @WebParam(name = "message", targetNamespace = "")
+ String message,
+ @WebParam(name = "asyncHandler", targetNamespace = "")
+ AsyncHandler<PingResponse> asyncHandler);
+
+ /**
+ *
+ * @param message
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "ping")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "ping", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Ping")
+ @ResponseWrapper(localName = "pingResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.PingResponse")
+ public String ping(
+ @WebParam(name = "message", targetNamespace = "")
+ String message);
+
+ /**
+ *
+ * @param message
+ * @return
+ * returns javax.xml.ws.Response<org.test.asyncdoclit.SleepResponse>
+ */
+ @WebMethod(operationName = "sleep", action = "sleep")
+ @RequestWrapper(localName = "sleep", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Sleep")
+ @ResponseWrapper(localName = "sleepResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.SleepResponse")
+ public Response<SleepResponse> sleepAsync(
+ @WebParam(name = "message", targetNamespace = "")
+ String message);
+
+ /**
+ *
+ * @param message
+ * @param asyncHandler
+ * @return
+ * returns java.util.concurrent.Future<? extends java.lang.Object>
+ */
+ @WebMethod(operationName = "sleep", action = "sleep")
+ @RequestWrapper(localName = "sleep", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Sleep")
+ @ResponseWrapper(localName = "sleepResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.SleepResponse")
+ public Future<?> sleepAsync(
+ @WebParam(name = "message", targetNamespace = "")
+ String message,
+ @WebParam(name = "asyncHandler", targetNamespace = "")
+ AsyncHandler<SleepResponse> asyncHandler);
+
+ /**
+ *
+ * @param message
+ */
+ @WebMethod(action = "sleep")
+ @RequestWrapper(localName = "sleep", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Sleep")
+ @ResponseWrapper(localName = "sleepResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.SleepResponse")
+ public void sleep(
+ @WebParam(name = "message", targetNamespace = "", mode = WebParam.Mode.INOUT)
+ Holder<String> message);
+
+ /**
+ *
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "isAsleep")
+ @WebResult(name = "message", targetNamespace = "")
+ @RequestWrapper(localName = "isAsleep", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.IsAsleep")
+ @ResponseWrapper(localName = "isAsleepResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.IsAsleepResponse")
+ public String isAsleep();
+
+ /**
+ *
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "wakeUp")
+ @WebResult(name = "message", targetNamespace = "")
+ @RequestWrapper(localName = "wakeUp", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.WakeUp")
+ @ResponseWrapper(localName = "wakeUpResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.WakeUpResponse")
+ public String wakeUp();
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns javax.xml.ws.Response<org.test.asyncdoclit.InvokeAsyncResponse>
+ */
+ @WebMethod(operationName = "invokeAsync", action = "invokeAsync")
+ @RequestWrapper(localName = "invokeAsync", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.InvokeAsync")
+ @ResponseWrapper(localName = "invokeAsyncResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.InvokeAsyncResponse")
+ public Response<InvokeAsyncResponse> invokeAsyncAsync(
+ @WebParam(name = "request", targetNamespace = "")
+ String request);
+
+ /**
+ *
+ * @param asyncHandler
+ * @param request
+ * @return
+ * returns java.util.concurrent.Future<? extends java.lang.Object>
+ */
+ @WebMethod(operationName = "invokeAsync", action = "invokeAsync")
+ @RequestWrapper(localName = "invokeAsync", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.InvokeAsync")
+ @ResponseWrapper(localName = "invokeAsyncResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.InvokeAsyncResponse")
+ public Future<?> invokeAsyncAsync(
+ @WebParam(name = "request", targetNamespace = "")
+ String request,
+ @WebParam(name = "asyncHandler", targetNamespace = "")
+ AsyncHandler<InvokeAsyncResponse> asyncHandler);
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "invokeAsync")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "invokeAsync", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.InvokeAsync")
+ @ResponseWrapper(localName = "invokeAsyncResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.InvokeAsyncResponse")
+ public String invokeAsync(
+ @WebParam(name = "request", targetNamespace = "")
+ String request);
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns javax.xml.ws.Response<org.test.asyncdoclit.CustomAsyncResponse>
+ */
+ @WebMethod(operationName = "customAsync", action = "customAsync")
+ @RequestWrapper(localName = "customAsync", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.CustomAsync")
+ @ResponseWrapper(localName = "customAsyncResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.CustomAsyncResponse")
+ public Response<CustomAsyncResponse> remappedAsync(
+ @WebParam(name = "request", targetNamespace = "")
+ String request);
+
+ /**
+ *
+ * @param asyncHandler
+ * @param request
+ * @return
+ * returns java.util.concurrent.Future<? extends java.lang.Object>
+ */
+ @WebMethod(operationName = "customAsync", action = "customAsync")
+ @RequestWrapper(localName = "customAsync", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.CustomAsync")
+ @ResponseWrapper(localName = "customAsyncResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.CustomAsyncResponse")
+ public Future<?> remappedAsync(
+ @WebParam(name = "request", targetNamespace = "")
+ String request,
+ @WebParam(name = "asyncHandler", targetNamespace = "")
+ AsyncHandler<CustomAsyncResponse> asyncHandler);
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(operationName = "customAsync", action = "customAsync")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "customAsync", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.CustomAsync")
+ @ResponseWrapper(localName = "customAsyncResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.CustomAsyncResponse")
+ public String remapped(
+ @WebParam(name = "request", targetNamespace = "")
+ String request);
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns javax.xml.ws.Response<org.test.asyncdoclit.AnotherResponse>
+ */
+ @WebMethod(operationName = "another", action = "another")
+ @RequestWrapper(localName = "another", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Another")
+ @ResponseWrapper(localName = "anotherResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.AnotherResponse")
+ public Response<AnotherResponse> anotherAsyncAsync(
+ @WebParam(name = "request", targetNamespace = "")
+ String request);
+
+ /**
+ *
+ * @param asyncHandler
+ * @param request
+ * @return
+ * returns java.util.concurrent.Future<? extends java.lang.Object>
+ */
+ @WebMethod(operationName = "another", action = "another")
+ @RequestWrapper(localName = "another", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Another")
+ @ResponseWrapper(localName = "anotherResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.AnotherResponse")
+ public Future<?> anotherAsyncAsync(
+ @WebParam(name = "request", targetNamespace = "")
+ String request,
+ @WebParam(name = "asyncHandler", targetNamespace = "")
+ AsyncHandler<AnotherResponse> asyncHandler);
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(operationName = "another", action = "another")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "another", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Another")
+ @ResponseWrapper(localName = "anotherResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.AnotherResponse")
+ public String anotherAsync(
+ @WebParam(name = "request", targetNamespace = "")
+ String request);
+
+ /**
+ *
+ * @param exceptionType
+ * @return
+ * returns javax.xml.ws.Response<org.test.asyncdoclit.ThrowExceptionResponse>
+ */
+ @WebMethod(operationName = "throwException", action = "throwException")
+ @RequestWrapper(localName = "throwException", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.ThrowException")
+ @ResponseWrapper(localName = "throwExceptionResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.ThrowExceptionResponse")
+ public Response<ThrowExceptionResponse> throwExceptionAsync(
+ @WebParam(name = "exceptionType", targetNamespace = "")
+ ExceptionTypeEnum exceptionType);
+
+ /**
+ *
+ * @param exceptionType
+ * @param asyncHandler
+ * @return
+ * returns java.util.concurrent.Future<? extends java.lang.Object>
+ */
+ @WebMethod(operationName = "throwException", action = "throwException")
+ @RequestWrapper(localName = "throwException", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.ThrowException")
+ @ResponseWrapper(localName = "throwExceptionResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.ThrowExceptionResponse")
+ public Future<?> throwExceptionAsync(
+ @WebParam(name = "exceptionType", targetNamespace = "")
+ ExceptionTypeEnum exceptionType,
+ @WebParam(name = "asyncHandler", targetNamespace = "")
+ AsyncHandler<ThrowExceptionResponse> asyncHandler);
+
+ /**
+ *
+ * @param exceptionType
+ * @return
+ * returns java.lang.String
+ * @throws ThrowExceptionFault
+ */
+ @WebMethod(action = "throwException")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "throwException", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.ThrowException")
+ @ResponseWrapper(localName = "throwExceptionResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.ThrowExceptionResponse")
+ public String throwException(
+ @WebParam(name = "exceptionType", targetNamespace = "")
+ ExceptionTypeEnum exceptionType)
+ throws ThrowExceptionFault
+ ;
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncService.java?rev=641584&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncService.java Wed Mar 26 14:31:52 2008
@@ -0,0 +1,71 @@
+//
+// Generated By:JAX-WS RI IBM 2.1.1 in JDK 6 (JAXB RI IBM JAXB 2.1.3 in JDK 1.6)
+//
+
+
+package org.apache.axis2.jaxws.sample.asyncdoclit.client;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceFeature;
+
+@WebServiceClient(name = "AsyncService", targetNamespace = "http://org/test/asyncdoclit", wsdlLocation = "async_doclitwr2.wsdl")
+public class AsyncService
+ extends Service
+{
+
+ private final static URL ASYNCSERVICE_WSDL_LOCATION;
+ private static String wsdlLocation="/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/async_doclitwr2.wsdl";
+ static {
+ URL url = null;
+ try {
+ try{
+ String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+ wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ File file = new File(wsdlLocation);
+ url = file.toURL();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ ASYNCSERVICE_WSDL_LOCATION = url;
+ }
+
+ public AsyncService(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ public AsyncService() {
+ super(ASYNCSERVICE_WSDL_LOCATION, new QName("http://org/test/asyncdoclit", "AsyncService"));
+ }
+
+ /**
+ *
+ * @return
+ * returns AsyncPort
+ */
+ @WebEndpoint(name = "AsyncPort")
+ public AsyncPort getAsyncPort() {
+ return (AsyncPort)super.getPort(new QName("http://org/test/asyncdoclit", "AsyncPort"), AsyncPort.class);
+ }
+
+ /**
+ *
+ * @param features
+ * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
+ * @return
+ * returns AsyncPort
+ */
+ @WebEndpoint(name = "AsyncPort")
+ public AsyncPort getAsyncPort(WebServiceFeature... features) {
+ return (AsyncPort)super.getPort(new QName("http://org/test/asyncdoclit", "AsyncPort"), AsyncPort.class, features);
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/ThrowExceptionFault.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/ThrowExceptionFault.java?rev=641584&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/ThrowExceptionFault.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/client/ThrowExceptionFault.java Wed Mar 26 14:31:52 2008
@@ -0,0 +1,53 @@
+//
+// Generated By:JAX-WS RI IBM 2.1.1 in JDK 6 (JAXB RI IBM JAXB 2.1.3 in JDK 1.6)
+//
+
+
+package org.apache.axis2.jaxws.sample.asyncdoclit.client;
+
+import javax.xml.ws.WebFault;
+
+import org.test.asyncdoclit.ThrowExceptionFaultBean;
+
+@WebFault(name = "throwExceptionFaultBean", targetNamespace = "http://org/test/asyncdoclit")
+public class ThrowExceptionFault
+ extends Exception
+{
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ *
+ */
+ private ThrowExceptionFaultBean faultInfo;
+
+ /**
+ *
+ * @param faultInfo
+ * @param message
+ */
+ public ThrowExceptionFault(String message, ThrowExceptionFaultBean faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ *
+ * @param faultInfo
+ * @param message
+ * @param cause
+ */
+ public ThrowExceptionFault(String message, ThrowExceptionFaultBean faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ *
+ * @return
+ * returns fault bean: jaxws.async.wsfvt.common.doclitwr.ThrowExceptionFaultBean
+ */
+ public ThrowExceptionFaultBean getFaultInfo() {
+ return faultInfo;
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/common/CallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/common/CallbackHandler.java?rev=641584&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/common/CallbackHandler.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/common/CallbackHandler.java Wed Mar 26 14:31:52 2008
@@ -0,0 +1,80 @@
+/*
+ * 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.axis2.jaxws.sample.asyncdoclit.common;
+
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeoutException;
+
+/**
+ * Generic Async callback handler. The get method emulates Response.get by
+ * throwning an exception if one is received.
+ */
+public class CallbackHandler<T> implements AsyncHandler<T> {
+
+ private T response = null;
+ private Response<T> resp = null;
+
+ private Exception exception = null;
+
+ public void handleResponse(Response<T> response) {
+
+ try {
+ T res = (T) response.get();
+ this.response = res;
+ this.resp = response;
+ } catch (Exception e) {
+ this.exception = e;
+ }
+ }
+
+ public Response<T> getResponse(){
+ return this.resp;
+ }
+
+ public T get() throws Exception {
+
+ if (exception != null)
+ throw exception;
+ return this.response;
+ }
+
+ /**
+ * Auxiliary method used to wait for a monitor for a certain amount of time
+ * before timing out
+ *
+ * @param monitor
+ */
+ public void waitBlocking(Future<?> monitor) throws Exception {
+ // wait for request to complete
+ int sec = 20; //Constants.CLIENT_MAX_SLEEP_SEC;
+ while (!monitor.isDone()) {
+ Thread.sleep(1000);
+ sec--;
+ if (sec <= 0) break;
+ }
+
+ if (sec <= 0)
+ throw new TimeoutException("Stopped waiting for Async response after "
+ + 20 /*Constants.CLIENT_MAX_SLEEP_SEC*/ + " sec");
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/AsyncPort.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/AsyncPort.java?rev=641584&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/AsyncPort.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/AsyncPort.java Wed Mar 26 14:31:52 2008
@@ -0,0 +1,128 @@
+//
+// Generated By:JAX-WS RI IBM 2.1.1 in JDK 6 (JAXB RI IBM JAXB 2.1.3 in JDK 1.6)
+//
+
+
+package org.apache.axis2.jaxws.sample.asyncdoclit.server;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+import org.test.asyncdoclit.ExceptionTypeEnum;
+
+@WebService(name = "AsyncPort2", targetNamespace = "http://org/test/asyncdoclit")
+public interface AsyncPort {
+
+
+ /**
+ *
+ * @param message
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "ping")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "ping", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Ping")
+ @ResponseWrapper(localName = "pingResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.PingResponse")
+ public String ping(
+ @WebParam(name = "message", targetNamespace = "")
+ String message);
+
+ /**
+ *
+ * @param message
+ */
+ @WebMethod(action = "sleep")
+ @RequestWrapper(localName = "sleep", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Sleep")
+ @ResponseWrapper(localName = "sleepResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.SleepResponse")
+ public void sleep(
+ @WebParam(name = "message", targetNamespace = "", mode = WebParam.Mode.INOUT)
+ Holder<String> message);
+
+ /**
+ *
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "isAsleep")
+ @WebResult(name = "message", targetNamespace = "")
+ @RequestWrapper(localName = "isAsleep", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.IsAsleep")
+ @ResponseWrapper(localName = "isAsleepResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.IsAsleepResponse")
+ public String isAsleep();
+
+ /**
+ *
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "wakeUp")
+ @WebResult(name = "message", targetNamespace = "")
+ @RequestWrapper(localName = "wakeUp", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.WakeUp")
+ @ResponseWrapper(localName = "wakeUpResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.WakeUpResponse")
+ public String wakeUp();
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "invokeAsync")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "invokeAsync", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.InvokeAsync")
+ @ResponseWrapper(localName = "invokeAsyncResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.InvokeAsyncResponse")
+ public String invokeAsync(
+ @WebParam(name = "request", targetNamespace = "")
+ String request);
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "customAsync")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "customAsync", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.CustomAsync")
+ @ResponseWrapper(localName = "customAsyncResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.CustomAsyncResponse")
+ public String customAsync(
+ @WebParam(name = "request", targetNamespace = "")
+ String request);
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns java.lang.String
+ */
+ @WebMethod(action = "another")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "another", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.Another")
+ @ResponseWrapper(localName = "anotherResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.AnotherResponse")
+ public String another(
+ @WebParam(name = "request", targetNamespace = "")
+ String request);
+
+ /**
+ *
+ * @param exceptionType
+ * @return
+ * returns java.lang.String
+ * @throws ThrowExceptionFault
+ */
+ @WebMethod(action = "throwException")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "throwException", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.ThrowException")
+ @ResponseWrapper(localName = "throwExceptionResponse", targetNamespace = "http://org/test/asyncdoclit", className = "org.test.asyncdoclit.ThrowExceptionResponse")
+ public String throwException(
+ @WebParam(name = "exceptionType", targetNamespace = "")
+ ExceptionTypeEnum exceptionType)
+ throws ThrowExceptionFault
+ ;
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/DocLitWrappedPortImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/DocLitWrappedPortImpl.java?rev=641584&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/DocLitWrappedPortImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/DocLitWrappedPortImpl.java Wed Mar 26 14:31:52 2008
@@ -0,0 +1,231 @@
+//
+// @(#) 1.2 WFVT/ws/code/websvcs.fvt/src/jaxws/async/wsfvt/server/DocLitWrappedPortImpl.java, WAS.websvcs.fvt, WSFP.WFVT 9/18/06 16:54:53 [9/26/06 09:46:44]
+//
+// IBM Confidential OCO Source Material
+// (C) COPYRIGHT International Business Machines Corp. 2006
+// The source code for this program is not published or otherwise divested
+// of its trade secrets, irrespective of what has been deposited with the
+// U.S. Copyright Office.
+//
+// Change History:
+// Date UserId Defect Description
+// ----------------------------------------------------------------------------
+// 09/18/06 sedov LIDB3296.38 New File
+// 09/26/06 sedov 393143 Added targetNS
+
+package org.apache.axis2.jaxws.sample.asyncdoclit.server;
+
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceException;
+
+import org.test.asyncdoclit.ExceptionTypeEnum;
+import org.test.asyncdoclit.ThrowExceptionFaultBean;
+
+/*
+import jaxws.async.wsfvt.common.Constants;
+import jaxws.async.wsfvt.common.doclitwr.AsyncPort;
+import jaxws.async.wsfvt.common.doclitwr.ExceptionTypeEnum;
+import jaxws.async.wsfvt.common.doclitwr.ThrowExceptionFault;
+import jaxws.async.wsfvt.common.doclitwr.ThrowExceptionFaultBean;
+*/
+/**
+ * Async endpoint used for Async client side tests. Clients will invokeAsync
+ * sleep method to force the server to block until wakeUp is called. The client
+ * can call isAsleep to verify that sleep has been called by the async thread.
+ */
+@WebService(serviceName="AsyncService2",
+ endpointInterface="org.apache.axis2.jaxws.sample.asyncdoclit.server.AsyncPort")
+public class DocLitWrappedPortImpl implements AsyncPort {
+
+ private static final boolean DEBUG = true;
+
+ // message on which the sleep method is sleeping on
+ private static String msg = "";
+
+ // thread instance that is currently sleeping so it can be interrupted from
+ // wakeup
+ private static Thread sleeper = null;
+
+ // interrupt flag for wakeUp to set
+ private static boolean doCancell = false;
+
+ public void sleep(Holder<String> message) {
+
+ try {
+ if (message == null || message.value == null) {
+ System.out.println("DocLitWrappedPortImpl.sleep(null) Enter");
+ }
+
+ if (DEBUG) System.out.println("DocLitWrappedPortImpl.sleep(" + message.value + ") Enter");
+
+ boolean cancelRequested = false;
+
+ msg = message.value;
+
+ synchronized (msg) {
+
+ Thread myThread = Thread.currentThread();
+ sleeper = myThread;
+
+ try {
+
+ doCancell = false;
+
+ if (DEBUG)
+ System.out.println("DocLitWrappedPortImpl.sleep: going to sleep on "
+ + myThread.getId() + " " + msg);
+
+ // wait until either a timeout or client releases us
+ // or if another request begins (lockId changes)
+ long sec = 15; //Constants.SERVER_SLEEP_SEC;
+
+ while (sec > 0 && !doCancell && sleeper == myThread) {
+ if (DEBUG)
+ System.out.println("DocLitWrappedPortImpl.sleep: " + myThread.getId()
+ + " timeLeft=" + sec);
+ sec--;
+
+ msg.wait(1000);
+ }
+ } catch (InterruptedException e) {
+ System.out.println("DocLitWrappedPortImpl.sleep: interrupted on " + myThread.getId());
+ } finally {
+
+ if (DEBUG)
+ System.out.println("DocLitWrappedPortImpl.sleep: WokeUp " + myThread.getId());
+
+ // if we timed out while waiting then
+ // release the wait
+ if (sleeper == myThread) {
+ cancelRequested = doCancell;
+ doCancell = false;
+ sleeper = null;
+ }
+
+ // only notify if cancel was requested
+ if (cancelRequested) {
+ if (DEBUG)
+ System.out.println("DocLitWrappedPortImpl.sleep: Notify " + myThread.getId()
+ + " isDone");
+
+ // wake up the release thread
+ msg.notify();
+ }
+ }
+ }// synch
+
+ msg = null;
+
+ if (DEBUG) System.out.println("DocLitWrappedPortImpl.sleep(" + message.value + ") Exit");
+ } catch (Exception e){
+ System.out.println("DocLitWrappedPortImpl.sleep: " + e);
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public String isAsleep() {
+ if (DEBUG) System.out.println("DocLitWrappedPortImpl.isAsleep() Enter");
+
+ String ret = (sleeper != null) ? msg : null;
+
+ if (DEBUG) System.out.println("DocLitWrappedPortImpl.isAsleep() = " + ret);
+
+ return ret;
+ }
+
+ public String wakeUp() {
+
+ if (DEBUG) System.out.println("DocLitWrappedPortImpl.wakeUp() Enter");
+
+ String wakeUp = null;
+
+ if (sleeper == null) {
+ if (DEBUG) System.out.println("DocLitWrappedPortImpl.wakeUp: No one to wake up");
+ } else {
+ if (DEBUG) System.out.println("DocLitWrappedPortImpl.wakeUp: Interrupting " + sleeper.getId());
+
+ // interrupt the sleeper & set inteerupt flag in case
+ // the sleep isn't sleeping but actually doing work
+ wakeUp = msg;
+ sleeper.interrupt();
+ doCancell = true;
+
+ if (DEBUG)
+ System.out.println("DocLitWrappedPortImpl.wakeUp: about to enter sync block "
+ + System.currentTimeMillis());
+
+ // block until sleep completes
+ if (msg != null) {
+ synchronized (msg) {
+
+ if (DEBUG)
+ System.out.println("DocLitWrappedPortImpl.wakeUp: enter sync block "
+ + System.currentTimeMillis());
+
+ doCancell = false;
+ }
+ }
+
+ msg = null;
+ }
+
+ if (DEBUG) System.out.println("DocLitWrappedPortImpl.wakeUp() = " + wakeUp);
+
+ return wakeUp;
+ }
+
+ /**
+ * client side tests for remapping operation names, on the server side all
+ * we need to do is roundtrip the message
+ */
+
+ public String invokeAsync(String request) {
+ System.out.println("DocLitWrappedPortImpl.invokeAsync " + request);
+ return request;
+ }
+
+ public String customAsync(String request) {
+ System.out.println("DocLitWrappedPortImpl.customAsync " + request);
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return request;
+ }
+
+ public String another(String request) {
+ System.out.println("DocLitWrappedPortImpl.another " + request);
+ return request;
+ }
+
+ public String ping(String message) {
+ System.out.println("DocLitWrappedPortImpl.ping " + message);
+ return message;
+ }
+
+ public String throwException(ExceptionTypeEnum exceptionType)
+ throws ThrowExceptionFault {
+ System.out.println("DocLitWrappedPortImpl.throwException " + exceptionType);
+
+ switch (exceptionType) {
+ case DIVIDE_BY_ZERO:
+ int div = 10 / 0;
+ break;
+ case NPE:
+ String x = null;
+ x.toString();
+ break;
+ case WSE:
+ throw new WebServiceException("WebServiceFault");
+ case WSDL_FAULT:
+ ThrowExceptionFaultBean tefb = new ThrowExceptionFaultBean();
+ tefb.setText("faultBean");
+ throw new ThrowExceptionFault("message", tefb);
+ }
+
+ return null;
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/MANIFEST.MF?rev=641584&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/MANIFEST.MF (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/MANIFEST.MF Wed Mar 26 14:31:52 2008
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.1
+Created-By: 2.3 (IBM Corporation)
+
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org