Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 37607 invoked from network); 15 May 2008 16:25:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 May 2008 16:25:20 -0000 Received: (qmail 59311 invoked by uid 500); 15 May 2008 16:25:21 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 59223 invoked by uid 500); 15 May 2008 16:25:21 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 59212 invoked by uid 500); 15 May 2008 16:25:21 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 59209 invoked by uid 99); 15 May 2008 16:25:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 May 2008 09:25:21 -0700 X-ASF-Spam-Status: No, hits=-1998.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 May 2008 16:24:43 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7C9282388A01; Thu, 15 May 2008 09:24:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r656721 - in /webservices/axis2/trunk/java/modules: jaxws-integration/test/org/apache/axis2/jaxws/sample/ kernel/src/org/apache/axis2/description/ kernel/src/org/apache/axis2/engine/ Date: Thu, 15 May 2008 16:24:58 -0000 To: axis2-cvs@ws.apache.org From: barrettj@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080515162458.7C9282388A01@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: barrettj Date: Thu May 15 09:24:57 2008 New Revision: 656721 URL: http://svn.apache.org/viewvc?rev=656721&view=rev Log: Synchronous API operations over async-on-the-wire MEP do not get notified of error conditions and timeout. SyncCallBack implementation of AxisCallback needs to be notified of onComplete() after onError(). Added test to verify behavior. Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java Modified: 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=656721&r1=656720&r2=656721&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java (original) +++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java Thu May 15 09:24:57 2008 @@ -18,6 +18,7 @@ */ package org.apache.axis2.jaxws.sample; +import java.net.ConnectException; import java.net.UnknownHostException; import java.util.Map; import java.util.concurrent.ExecutionException; @@ -50,12 +51,19 @@ public class RuntimeExceptionsAsyncMepTest extends AbstractTestCase { private static final String DOCLITWR_ASYNC_ENDPOINT = "http://localhost:6060/axis2/services/AsyncService2.DocLitWrappedPortImplPort"; - + private static final String CONNECT_EXCEPTION_ENDPOINT = "http://localhost:6061/axis2/services/AsyncService2.DocLitWrappedPortImplPort"; 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"; + /* + * For async-on-the-wire exchanges, we need to enable WS-Addressing and get a transport + * listener setup to receive the inbound request from the service-provider which contains the + * response. We only need to do that one time for all the tests. + */ + static boolean listenerAlreadySetup = false; + public static Test suite() { Test test = getTestSetup(new TestSuite( RuntimeExceptionsAsyncMepTest.class), null, @@ -75,6 +83,33 @@ return port; } + /** + * @testStrategy Invoke the proxy with sync method, specifying that it should use + * the async-on-the-wire MEP. The proxy enpdoint specifies a port that + * does not exist. Verify that the connection exception is received + * by the client. + */ + + public void testAsyncCallback_asyncWire_ConnectException() throws Exception { + setupAddressingAndListener(); + + AsyncPort port = getPort(); + Map rc = ((BindingProvider) port).getRequestContext(); + rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, CONNECT_EXCEPTION_ENDPOINT); + rc.put("org.apache.axis2.jaxws.use.async.mep", Boolean.TRUE); + + try { + String resp = port.throwException(ExceptionTypeEnum.WSE); + fail("Did not get an exception as expected"); + } catch (Exception ee) { + assertTrue("ExecutionException.getCause should be an instance of WebServiceException", + ee instanceof WebServiceException); + assertTrue("Didn't get a cause within the WebServiceException", + ee.getCause() != null); + assertTrue("Cause was not ConnectionException as expected", + ee.getCause() instanceof ConnectException); + } + } /** * @testStrategy Invoke the proxy with async-polling method, the proxy is @@ -317,19 +352,7 @@ */ public void testAsyncCallback_asyncMEP_asyncWire_Addressing_WebServiceException() throws Exception { - - // we want to use addressing on the client side - String repopath = System.getProperty("basedir", ".") + "/" - + System.getProperty("build.repository"); - String axis2xmlpath = System.getProperty("basedir", ".") - + "/test-resources/axis2_addressing.xml"; - FileSystemConfigurator configurator = new FileSystemConfigurator( - repopath, axis2xmlpath); - ClientConfigurationFactory factory = new ClientConfigurationFactory( - configurator); - MetadataFactoryRegistry.setFactory(ClientConfigurationFactory.class, - factory); - + setupAddressingAndListener(); AsyncPort port = getPort(); Map rc = ((BindingProvider) port).getRequestContext(); @@ -395,5 +418,29 @@ return found; } + + + /** + * Setup to use addressing and to start a listener to receive inbound async responses + * from the service-provider. + * + * @throws Exception + */ + synchronized private void setupAddressingAndListener() throws Exception { + if (!listenerAlreadySetup) { + listenerAlreadySetup = true; + // we want to use addressing on the client side + String repopath = System.getProperty("basedir", ".") + "/" + + System.getProperty("build.repository"); + String axis2xmlpath = System.getProperty("basedir", ".") + + "/test-resources/axis2_addressing.xml"; + FileSystemConfigurator configurator = new FileSystemConfigurator( + repopath, axis2xmlpath); + ClientConfigurationFactory factory = new ClientConfigurationFactory( + configurator); + MetadataFactoryRegistry.setFactory(ClientConfigurationFactory.class, + factory); + } + } } Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java?rev=656721&r1=656720&r2=656721&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java Thu May 15 09:24:57 2008 @@ -450,7 +450,7 @@ AxisFault fault = new AxisFault(body.getFault(), response); if (callback != null) { callback.onError(fault); - } else { + } else if (axisCallback != null) { axisCallback.onError(fault); } @@ -458,7 +458,7 @@ if (callback != null) { AsyncResult asyncResult = new AsyncResult(response); callback.onComplete(asyncResult); - } else { + } else if (axisCallback != null) { axisCallback.onMessage(response); } @@ -468,13 +468,15 @@ } catch (Exception e) { if (callback != null) { callback.onError(e); - } else { + } else if (axisCallback != null) { axisCallback.onError(e); } } finally { if (callback != null) { callback.setComplete(true); + }else if (axisCallback != null) { + axisCallback.onComplete(); } } } Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?rev=656721&r1=656720&r2=656721&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java Thu May 15 09:24:57 2008 @@ -639,11 +639,20 @@ Object callback = ((CallbackReceiver) msgReceiver) .lookupCallback(msgctx.getMessageID()); if (callback == null) return; // TODO: should we log this?? - + if (callback instanceof Callback) { + // Instances of Callback only expect onComplete to be called + // for a successful MEP. Errors are reported through the + // Async Response object, which the Callback implementations + // all use. ((Callback)callback).onError(e); } else { + // The AxisCallback (which is OutInAxisOperationClient$SyncCallBack + // used to support async-on-the-wire under a synchronous API + // operation) need to be told the MEP is complete after being told + // of the error. ((AxisCallback)callback).onError(e); + ((AxisCallback)callback).onComplete(); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org