cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
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 GMT
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<Message> {
+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);
+            }
         }
     }
 



Mime
View raw message