Author: dkulp
Date: Mon Oct 8 11:18:42 2007
New Revision: 582925
URL: http://svn.apache.org/viewvc?rev=582925&view=rev
Log:
Merged revisions 581675 via svnmerge from
https://svn.apache.org/repos/asf/incubator/cxf/trunk
........
r581675 | dkulp | 2007-10-03 14:15:25 -0400 (Wed, 03 Oct 2007) | 2 lines
[CXF-1080] Fixes for JAX-WS when there isn't a @WebFault annotation on the
exception
........
Modified:
incubator/cxf/branches/2.0.x-fixes/ (props changed)
incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionService.java
incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionService.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionService.java?rev=582925&r1=582924&r2=582925&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionService.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionService.java
Mon Oct 8 11:18:42 2007
@@ -18,6 +18,11 @@
*/
package org.apache.cxf.aegis.exception;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
[EMAIL PROTECTED](name = "ExceptionService", serviceName = "ExceptionService")
public interface ExceptionService {
+ @WebMethod
String sayHiWithException() throws HelloException;
}
Modified:
incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java?rev=582925&r1=582924&r2=582925&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/exception/ExceptionTest.java
Mon Oct 8 11:18:42 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/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java?rev=582925&r1=582924&r2=582925&view=diff
==============================================================================
---
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
(original)
+++
incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
Mon Oct 8 11:18:42 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);
+ }
}
}