cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1420627 - in /cxf/trunk/rt/ws/rm/src: main/java/org/apache/cxf/ws/rm/ main/java/org/apache/cxf/ws/rm/soap/ test/java/org/apache/cxf/ws/rm/ test/java/org/apache/cxf/ws/rm/soap/
Date Wed, 12 Dec 2012 11:48:40 GMT
Author: ay
Date: Wed Dec 12 11:48:38 2012
New Revision: 1420627

URL: http://svn.apache.org/viewvc?rev=1420627&view=rev
Log:
[CXF-4694] WS-RM is not returing a correct soap fault message to the client

Modified:
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/SoapFaultFactory.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/AbstractRMInterceptorTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/SoapFaultFactoryTest.java

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java?rev=1420627&r1=1420626&r2=1420627&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java Wed Dec 12
11:48:38 2012
@@ -24,6 +24,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.ws.addressing.AddressingProperties;
@@ -58,6 +59,16 @@ public class RMInInterceptor extends Abs
             } catch (RMException e) {
                 LOG.log(Level.WARNING, "Failed to revert the delivering status");
             }
+        } else if (!ContextUtils.isRequestor(message)) {
+            // force the fault to be returned.
+            Exchange exchange = message.getExchange();
+            exchange.setOneWay(false);
+
+            final AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, false,
true);
+            if (maps != null && !ContextUtils.isGenericAddress(maps.getFaultTo()))
{
+                //TODO look at how we can refactor all these decoupled faultTo stuff
+                exchange.setDestination(ContextUtils.createDecoupledDestination(exchange,
maps.getFaultTo()));
+            }
         }
     }
 

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/SoapFaultFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/SoapFaultFactory.java?rev=1420627&r1=1420626&r2=1420627&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/SoapFaultFactory.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/SoapFaultFactory.java Wed Dec
12 11:48:38 2012
@@ -71,12 +71,12 @@ public class SoapFaultFactory implements
     Fault createSoap11Fault(SequenceFault sf) {
         SoapFault fault = new SoapFault(sf.getReason(),
             sf.isSender() ? version.getSender() : version.getReceiver());
-        fault.setSubCode(sf.getFaultCode());
         return fault;
     }
     
     Fault createSoap12Fault(SequenceFault sf, Message msg) {
         SoapFault fault = (SoapFault)createSoap11Fault(sf);
+        fault.setSubCode(sf.getFaultCode());
         Object detail = sf.getDetail();
         if (null == detail) {
             return fault;

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/AbstractRMInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/AbstractRMInterceptorTest.java?rev=1420627&r1=1420626&r2=1420627&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/AbstractRMInterceptorTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/AbstractRMInterceptorTest.java Wed
Dec 12 11:48:38 2012
@@ -82,7 +82,7 @@ public class AbstractRMInterceptorTest e
         SequenceFault sf = control.createMock(SequenceFault.class);
         interceptor.setSequenceFault(sf);
         Exchange ex = control.createMock(Exchange.class);
-        EasyMock.expect(message.getExchange()).andReturn(ex);
+        EasyMock.expect(message.getExchange()).andReturn(ex).anyTimes();
         Endpoint e = control.createMock(Endpoint.class);
         EasyMock.expect(ex.get(Endpoint.class)).andReturn(e);
         EasyMock.expect(e.getBinding()).andReturn(null);
@@ -102,7 +102,7 @@ public class AbstractRMInterceptorTest e
         SequenceFault sf = control.createMock(SequenceFault.class);
         interceptor.setSequenceFault(sf);
         Exchange ex = control.createMock(Exchange.class);
-        EasyMock.expect(message.getExchange()).andReturn(ex);
+        EasyMock.expect(message.getExchange()).andReturn(ex).anyTimes();
         Endpoint e = control.createMock(Endpoint.class);
         EasyMock.expect(ex.get(Endpoint.class)).andReturn(e);
         Binding b = control.createMock(Binding.class);

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java?rev=1420627&r1=1420626&r2=1420627&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java Wed Dec
12 11:48:38 2012
@@ -328,7 +328,6 @@ public class RMInInterceptorTest extends
             interceptor.handle(message);
             fail("must reject the invalid rm message");
         } catch (Exception e) {
-            System.out.println(e);
             assertTrue(e instanceof RMException);
             // verify a partial error text match to exclude an unexpected exception
             // (see WSRM_REQUIRED_EXC in Messages.properties)
@@ -345,6 +344,8 @@ public class RMInInterceptorTest extends
         Message message = control.createMock(Message.class);
         Exchange exchange = control.createMock(Exchange.class);
         EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes();
+        exchange.setOneWay(false);
+        EasyMock.expectLastCall();
         control.replay();
         
         try {

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/SoapFaultFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/SoapFaultFactoryTest.java?rev=1420627&r1=1420626&r2=1420627&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/SoapFaultFactoryTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/soap/SoapFaultFactoryTest.java Wed
Dec 12 11:48:38 2012
@@ -62,7 +62,7 @@ public class SoapFaultFactoryTest extend
         sf = control.createMock(SequenceFault.class);
         EasyMock.expect(sf.getReason()).andReturn("reason");
         EasyMock.expect(sf.isSender()).andReturn(isSender);
-        EasyMock.expect(sf.getFaultCode()).andReturn(code);
+        EasyMock.expect(sf.getFaultCode()).andReturn(code).anyTimes();
         if (null != detail) {
             EasyMock.expect(sf.getDetail()).andReturn(detail);
             SequenceFaultType sft = new SequenceFaultType();
@@ -81,7 +81,7 @@ public class SoapFaultFactoryTest extend
         SoapFault fault = (SoapFault)factory.createFault(sf, createInboundMessage());
         assertEquals("reason", fault.getReason());
         assertEquals(Soap11.getInstance().getReceiver(), fault.getFaultCode());
-        assertEquals(RM10Constants.SEQUENCE_TERMINATED_FAULT_QNAME, fault.getSubCode());
+        assertNull(fault.getSubCode());
         assertNull(fault.getDetail());
         assertSame(sf, fault.getCause());
         control.verify();        



Mime
View raw message