cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1241639 - in /cxf/trunk: rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
Date Tue, 07 Feb 2012 21:32:20 GMT
Author: dkulp
Date: Tue Feb  7 21:32:20 2012
New Revision: 1241639

URL: http://svn.apache.org/viewvc?rev=1241639&view=rev
Log:
[CXF-3916] If a response message doesn't have a RelatesTo header, do
some additional checking to see if it should be marked a partial
response or not.

Modified:
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java
    cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java?rev=1241639&r1=1241638&r2=1241639&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java
(original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/impl/MAPAggregatorImpl.java
Tue Feb  7 21:32:20 2012
@@ -537,6 +537,18 @@ public class MAPAggregatorImpl extends M
                                                           Names.HEADER_REQUIRED_NAME));
                 }
             }
+            if (MessageUtils.isPartialResponse(message)) {
+                // marked as a partial response, let's see if it really is
+                MessageInfo min = message.get(MessageInfo.class);
+                MessageInfo mout = message.getExchange().getOutMessage().get(MessageInfo.class);
+                if (min != null && mout != null 
+                    && min.getOperation() == mout.getOperation()
+                    && message.getContent(List.class) != null) {
+                    // the in and out messages are on the same operation 
+                    // and we were able to get a response for it.
+                    message.remove(Message.PARTIAL_RESPONSE_MESSAGE);
+                }
+            }
         }
         return continueProcessing;
     }

Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java?rev=1241639&r1=1241638&r2=1241639&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
(original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
Tue Feb  7 21:32:20 2012
@@ -21,10 +21,21 @@ package org.apache.cxf.systest.ws.addr_f
 
 import java.io.ByteArrayOutputStream;
 import java.net.URL;
+import java.util.List;
+
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.soap.SOAPFaultException;
 
+
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor;
+import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.headers.Header;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.phase.Phase;
 import org.apache.cxf.systest.ws.AbstractWSATestBase;
 import org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl;
 import org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImplService;
@@ -191,4 +202,43 @@ public class WSAFromJavaTest extends Abs
         long end = System.currentTimeMillis();
         assertTrue((end - start) < 50000);
     }
+    
+    static class RemoveRelatesToHeaderInterceptor extends AbstractSoapInterceptor {
+        public RemoveRelatesToHeaderInterceptor() {
+            super(Phase.READ);
+            addAfter(ReadHeadersInterceptor.class.getName());
+        }
+        @Override
+        public void handleMessage(SoapMessage message) throws Fault {
+            List<Header> headers = message.getHeaders();
+            Header h2 = null;
+            for (Header h : headers) {
+                if ("RelatesTo".equals(h.getName().getLocalPart())) {
+                    h2 = h;
+                }
+            }
+            headers.remove(h2);
+        }
+    }
+    
+    @Test
+    public void testNoRelatesToHeader() throws Exception {
+        new LoggingFeature().initialize(this.getBus());
+        AddNumberImpl port = getPort();
+
+        Client c = ClientProxy.getClient(port);
+        c.getInInterceptors().add(new RemoveRelatesToHeaderInterceptor());
+        
+        
+        long start = System.currentTimeMillis();
+        port.addNumbers(1, 2);
+        try {
+            port.addNumbers3(-1, -1);
+        } catch (Exception ex) {
+            //ignore, expected
+        }
+        long end = System.currentTimeMillis();
+        assertTrue((end - start) < 50000);
+    }    
+    
 }
\ No newline at end of file



Mime
View raw message