Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 62752 invoked from network); 26 Apr 2007 05:14:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Apr 2007 05:14:42 -0000 Received: (qmail 53956 invoked by uid 500); 26 Apr 2007 05:14:48 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 53902 invoked by uid 500); 26 Apr 2007 05:14:48 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 53893 invoked by uid 99); 26 Apr 2007 05:14:48 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2007 22:14:48 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2007 22:14:40 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 9AAD41A9838; Wed, 25 Apr 2007 22:14:20 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r532610 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ systests/src/test/java/org/apache/cxf/systest/jaxws/ Date: Thu, 26 Apr 2007 05:14:20 -0000 To: cxf-commits@incubator.apache.org From: gawor@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070426051420.9AAD41A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gawor Date: Wed Apr 25 22:14:19 2007 New Revision: 532610 URL: http://svn.apache.org/viewvc?view=rev&rev=532610 Log: in http binding throw HTTPExceptions Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?view=diff&rev=532610&r1=532609&r2=532610 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Wed Apr 25 22:14:19 2007 @@ -19,6 +19,7 @@ package org.apache.cxf.jaxws; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -37,6 +38,8 @@ import javax.xml.ws.Response; import javax.xml.ws.Service; import javax.xml.ws.WebServiceException; +import javax.xml.ws.http.HTTPBinding; +import javax.xml.ws.http.HTTPException; import org.apache.cxf.Bus; import org.apache.cxf.common.logging.LogUtils; @@ -144,7 +147,13 @@ getConduitSelector().complete(exchange); if (message.getContent(Exception.class) != null) { - throw new WebServiceException(message.getContent(Exception.class)); + if (getBinding() instanceof HTTPBinding) { + HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR); + exception.initCause(message.getContent(Exception.class)); + throw exception; + } else { + throw new WebServiceException(message.getContent(Exception.class)); + } } // correlate response Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?view=diff&rev=532610&r1=532609&r2=532610 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java Wed Apr 25 22:14:19 2007 @@ -21,6 +21,7 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; +import java.net.HttpURLConnection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -35,6 +36,8 @@ import javax.xml.ws.Response; import javax.xml.ws.WebServiceException; import javax.xml.ws.handler.MessageContext; +import javax.xml.ws.http.HTTPBinding; +import javax.xml.ws.http.HTTPException; import org.apache.cxf.common.i18n.Message; import org.apache.cxf.common.logging.LogUtils; @@ -131,7 +134,14 @@ throw ex.fillInStackTrace(); } } - throw new WebServiceException(ex); + + if (getBinding() instanceof HTTPBinding) { + HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR); + exception.initCause(ex); + throw exception; + } else { + throw new WebServiceException(ex); + } } // need to do context mapping from cxf message to jax-ws ContextPropertiesMapping.mapResponsefromCxf2Jaxws(respContext); Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java?view=diff&rev=532610&r1=532609&r2=532610 ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java Wed Apr 25 22:14:19 2007 @@ -30,6 +30,7 @@ import javax.xml.ws.BindingProvider; import javax.xml.ws.Holder; import javax.xml.ws.Service; +import javax.xml.ws.http.HTTPException; import javax.xml.xpath.XPathConstants; import org.w3c.dom.Document; @@ -272,8 +273,8 @@ try { greeterFault.pingMe(); fail("did not catch expected runtime exception"); - } catch (Exception ex) { - assertTrue("check expected message of exception", ex.getMessage().indexOf( + } catch (HTTPException ex) { + assertTrue("check expected message of exception", ex.getCause().getMessage().indexOf( GreeterFaultImpl.RUNTIME_EXCEPTION_MESSAGE) >= 0); } }