Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 21319 invoked from network); 3 Oct 2007 18:16:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Oct 2007 18:16:24 -0000 Received: (qmail 82743 invoked by uid 500); 3 Oct 2007 18:16:09 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 82700 invoked by uid 500); 3 Oct 2007 18:16:08 -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 82685 invoked by uid 99); 3 Oct 2007 18:16:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2007 11:16:08 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED 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, 03 Oct 2007 18:16:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 946421A9832; Wed, 3 Oct 2007 11:15:28 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r581675 - in /incubator/cxf/trunk/rt: databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ Date: Wed, 03 Oct 2007 18:15:27 -0000 To: cxf-commits@incubator.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071003181528.946421A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Wed Oct 3 11:15:25 2007 New Revision: 581675 URL: http://svn.apache.org/viewvc?rev=581675&view=rev Log: [CXF-1080] Fixes for JAX-WS when there isn't a @WebFault annotation on the exception Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionService.java incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionService.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionService.java?rev=581675&r1=581674&r2=581675&view=diff ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionService.java (original) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionService.java Wed Oct 3 11:15:25 2007 @@ -18,6 +18,11 @@ */ package org.apache.cxf.aegis.exception; +import javax.jws.WebMethod; +import javax.jws.WebService; + +@WebService(name = "ExceptionService", serviceName = "ExceptionService") public interface ExceptionService { + @WebMethod String sayHiWithException() throws HelloException; } Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java?rev=581675&r1=581674&r2=581675&view=diff ============================================================================== --- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java (original) +++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java Wed Oct 3 11:15:25 2007 @@ -19,10 +19,15 @@ package org.apache.cxf.aegis.exception; import org.apache.cxf.aegis.AbstractAegisTest; +import org.apache.cxf.aegis.databinding.AegisDatabinding; import org.apache.cxf.endpoint.Server; import org.apache.cxf.frontend.ClientProxyFactoryBean; +import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; +import org.apache.cxf.jaxws.JaxWsServerFactoryBean; +import org.apache.cxf.service.Service; import org.apache.cxf.service.invoker.BeanInvoker; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; public class ExceptionTest extends AbstractAegisTest { @@ -50,6 +55,69 @@ } catch (HelloException e) { // nothing } + } + + @Test(expected = HelloException.class) + @Ignore("Not working yet due to namespace things") + public void testJaxwsServerSimpleClient() throws Exception { + JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean(); + sfbean.setServiceClass(ExceptionService.class); + sfbean.setDataBinding(new AegisDatabinding()); + sfbean.setAddress("local://ExceptionServiceJaxWs1"); + Server server = sfbean.create(); + Service service = server.getEndpoint().getService(); + service.setInvoker(new BeanInvoker(new ExceptionServiceImpl())); + + ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); + proxyFac.setAddress("local://ExceptionServiceJaxWs1"); + proxyFac.setServiceClass(ExceptionService.class); + proxyFac.setBus(getBus()); + setupAegis(proxyFac.getClientFactoryBean()); + + ExceptionService clientInterface = (ExceptionService)proxyFac.create(); + + clientInterface.sayHiWithException(); + } + + @Test(expected = HelloException.class) + public void testJaxwsNoXfireCompat() throws Exception { + JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean(); + sfbean.setServiceClass(ExceptionService.class); + sfbean.setDataBinding(new AegisDatabinding()); + sfbean.getServiceFactory().setDataBinding(sfbean.getDataBinding()); + sfbean.setAddress("local://ExceptionServiceJaxWs"); + Server server = sfbean.create(); + Service service = server.getEndpoint().getService(); + service.setInvoker(new BeanInvoker(new ExceptionServiceImpl())); + + JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); + proxyFac.setAddress("local://ExceptionServiceJaxWs"); + proxyFac.setServiceClass(ExceptionService.class); + proxyFac.setBus(getBus()); + proxyFac.getClientFactoryBean().getServiceFactory().setDataBinding(new AegisDatabinding()); + ExceptionService clientInterface = (ExceptionService)proxyFac.create(); + + clientInterface.sayHiWithException(); + } + + @Test(expected = HelloException.class) + public void testJaxws() throws Exception { + JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean(); + sfbean.setServiceClass(ExceptionService.class); + setupAegis(sfbean); + sfbean.setAddress("local://ExceptionService4"); + Server server = sfbean.create(); + Service service = server.getEndpoint().getService(); + service.setInvoker(new BeanInvoker(new ExceptionServiceImpl())); + + JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); + proxyFac.setAddress("local://ExceptionService4"); + proxyFac.setServiceClass(ExceptionService.class); + proxyFac.setBus(getBus()); + setupAegis(proxyFac.getClientFactoryBean()); + ExceptionService clientInterface = (ExceptionService)proxyFac.create(); + + clientInterface.sayHiWithException(); } public static class ExceptionServiceImpl implements ExceptionService { Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java?rev=581675&r1=581674&r2=581675&view=diff ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java Wed Oct 3 11:15:25 2007 @@ -34,23 +34,23 @@ import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.databinding.DataWriter; import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.interceptor.FaultOutInterceptor; import org.apache.cxf.jaxws.support.JaxWsServiceConfiguration; +import org.apache.cxf.message.FaultMode; import org.apache.cxf.message.Message; -import org.apache.cxf.phase.AbstractPhaseInterceptor; -import org.apache.cxf.phase.Phase; import org.apache.cxf.service.Service; import org.apache.cxf.service.model.BindingOperationInfo; import org.apache.cxf.service.model.FaultInfo; import org.apache.cxf.service.model.MessagePartInfo; import org.apache.cxf.service.model.OperationInfo; -public class WebFaultOutInterceptor extends AbstractPhaseInterceptor { +public class WebFaultOutInterceptor extends FaultOutInterceptor { private static final Logger LOG = LogUtils.getL7dLogger(WebFaultOutInterceptor.class); private static final ResourceBundle BUNDLE = BundleUtils.getBundle(JaxWsServiceConfiguration.class); public WebFaultOutInterceptor() { - super(Phase.PRE_PROTOCOL); + super(); } private QName getFaultName(WebFault wf, Class cls, OperationInfo op) { @@ -112,6 +112,13 @@ writer.write(faultInfo, part, f.getOrCreateDetail()); f.setMessage(ex.getMessage()); + } else { + FaultMode mode = message.get(FaultMode.class); + if (mode == FaultMode.CHECKED_APPLICATION_FAULT) { + //only convert checked exceptions with this + //otherwise delegate down to the normal protocol specific stuff + super.handleMessage(message); + } } }