cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r683094 - in /cxf/branches/2.0.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ rt/fr...
Date Wed, 06 Aug 2008 03:11:20 GMT
Author: dkulp
Date: Tue Aug  5 20:11:20 2008
New Revision: 683094

URL: http://svn.apache.org/viewvc?rev=683094&view=rev
Log:
Merged revisions 683089 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r683089 | dkulp | 2008-08-05 22:43:19 -0400 (Tue, 05 Aug 2008) | 3 lines
  
  [CXF-1733] Merge SoapActionOut and SoapPreProtocolOut nterceptors to 
  make sure the action and content types are properly set.
........

Modified:
    cxf/branches/2.0.x-fixes/   (props changed)
    cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionOutInterceptor.java
    cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapPreProtocolOutInterceptor.java
    cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapActionInterceptorTest.java
    cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
    cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
    cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/hello_world_soap12.wsdl

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug  5 20:11:20 2008
@@ -1 +1 @@
-/cxf/trunk:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951
+/cxf/trunk:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=683094&r1=683093&r2=683094&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
Tue Aug  5 20:11:20 2008
@@ -49,7 +49,6 @@
 import org.apache.cxf.binding.soap.interceptor.Soap12FaultInInterceptor;
 import org.apache.cxf.binding.soap.interceptor.Soap12FaultOutInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor;
-import org.apache.cxf.binding.soap.interceptor.SoapActionOutInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapHeaderInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor;
@@ -342,7 +341,6 @@
             sb.getInInterceptors().add(new StaxInInterceptor());
             sb.getInInterceptors().add(new SoapActionInInterceptor());
             
-            sb.getOutInterceptors().add(new SoapActionOutInterceptor());
             sb.getOutInterceptors().add(new AttachmentOutInterceptor());
             sb.getOutInterceptors().add(new StaxOutInterceptor());
             sb.getOutInterceptors().add(new SoapHeaderOutFilterInterceptor());

Modified: cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionOutInterceptor.java?rev=683094&r1=683093&r2=683094&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionOutInterceptor.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionOutInterceptor.java
Tue Aug  5 20:11:20 2008
@@ -19,22 +19,16 @@
 
 package org.apache.cxf.binding.soap.interceptor;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.binding.soap.Soap11;
-import org.apache.cxf.binding.soap.Soap12;
-import org.apache.cxf.binding.soap.SoapConstants;
 import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.binding.soap.model.SoapOperationInfo;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
-import org.apache.cxf.service.model.BindingOperationInfo;
 
+
+/**
+ * This has been merged into the SoapPreProtocolOutInterceptor
+ * to make sure the content type is set properly only once.
+ */
+@Deprecated
 public class SoapActionOutInterceptor extends AbstractSoapInterceptor {
     
     public SoapActionOutInterceptor() {
@@ -42,64 +36,7 @@
     }
     
     public void handleMessage(SoapMessage message) throws Fault {
-        if (!(message == message.getExchange().getInMessage())) {
-            setSoapAction(message);
-        }
-    }
-
-    private void setSoapAction(SoapMessage message) {
-        BindingOperationInfo boi = message.getExchange().get(BindingOperationInfo.class);
-        
-        // The soap action is set on the wrapped operation.
-        if (boi != null && boi.isUnwrapped()) {
-            boi = boi.getWrappedOperation();
-        }
-        
-        String action = getSoapAction(message, boi);
-        
-        if (message.getVersion() instanceof Soap11) {
-            Map<String, List<String>> reqHeaders = CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
-            if (reqHeaders == null) {
-                reqHeaders = new HashMap<String, List<String>>();
-            }
-            
-            if (reqHeaders.size() == 0) {
-                message.put(Message.PROTOCOL_HEADERS, reqHeaders);
-            }
-            
-            if (!reqHeaders.containsKey(SoapConstants.SOAP_ACTION)) {            
-                reqHeaders.put(SoapConstants.SOAP_ACTION, Collections.singletonList(action));
-            }
-        } else if (message.getVersion() instanceof Soap12 && !"\"\"".equals(action))
{
-            String ct = (String) message.get(Message.CONTENT_TYPE);
-            
-            if (ct.indexOf("action=\"") == -1) {
-                ct = new StringBuilder().append(ct)
-                    .append("; action=").append(action).toString();
-                message.put(Message.CONTENT_TYPE, ct);
-            }
-        }
-    }
-
-    private String getSoapAction(SoapMessage message, BindingOperationInfo boi) {
-        // allow an interceptor to override the SOAPAction if need be
-        String action = (String) message.get(SoapConstants.SOAP_ACTION);
-        
-        // Fall back on the SOAPAction in the operation info
-        if (action == null) {
-            if (boi == null) {
-                action = "\"\"";
-            } else {
-                SoapOperationInfo soi = (SoapOperationInfo) boi.getExtensor(SoapOperationInfo.class);
-                action = soi == null ? "\"\"" : soi.getAction() == null ? "\"\"" : soi.getAction();
-            }
-        }
-        
-        if (!action.startsWith("\"")) {
-            action = new StringBuffer().append("\"").append(action).append("\"").toString();
-        }
-        
-        return action;
+        //no-op
     }
 
 }

Modified: cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapPreProtocolOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapPreProtocolOutInterceptor.java?rev=683094&r1=683093&r2=683094&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapPreProtocolOutInterceptor.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapPreProtocolOutInterceptor.java
Tue Aug  5 20:11:20 2008
@@ -19,16 +19,22 @@
 
 package org.apache.cxf.binding.soap.interceptor;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.binding.soap.Soap12;
+import org.apache.cxf.binding.soap.SoapBindingConstants;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
-import org.apache.cxf.interceptor.AttachmentOutInterceptor;
+import org.apache.cxf.binding.soap.model.SoapOperationInfo;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingOperationInfo;
 
 import static org.apache.cxf.message.Message.MIME_HEADERS;
 
@@ -40,8 +46,7 @@
 public class SoapPreProtocolOutInterceptor extends AbstractSoapInterceptor {
 
     public SoapPreProtocolOutInterceptor() {
-        super(Phase.PRE_STREAM);
-        getBefore().add(AttachmentOutInterceptor.class.getName());
+        super(Phase.POST_LOGICAL);
     }
 
     /**
@@ -53,6 +58,10 @@
     public void handleMessage(SoapMessage message) throws Fault {
         ensureVersion(message);
         ensureMimeHeaders(message);
+        if (isRequestor(message)) {
+            setSoapAction(message);
+        }
+
     }
     
     /**
@@ -86,4 +95,60 @@
             message.put(MIME_HEADERS, new HashMap<String, List<String>>());
         }
     }
+    
+    private void setSoapAction(SoapMessage message) {
+        BindingOperationInfo boi = message.getExchange().get(BindingOperationInfo.class);
+        
+        // The soap action is set on the wrapped operation.
+        if (boi != null && boi.isUnwrapped()) {
+            boi = boi.getWrappedOperation();
+        }
+        
+        String action = getSoapAction(message, boi);
+        
+        if (message.getVersion() instanceof Soap11) {
+            Map<String, List<String>> reqHeaders = CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
+            if (reqHeaders == null) {
+                reqHeaders = new HashMap<String, List<String>>();
+            }
+            
+            if (reqHeaders.size() == 0) {
+                message.put(Message.PROTOCOL_HEADERS, reqHeaders);
+            }
+            
+            if (!reqHeaders.containsKey(SoapBindingConstants.SOAP_ACTION)) {            
+                reqHeaders.put(SoapBindingConstants.SOAP_ACTION, Collections.singletonList(action));
+            }
+        } else if (message.getVersion() instanceof Soap12 && !"\"\"".equals(action))
{
+            String ct = (String) message.get(Message.CONTENT_TYPE);
+            
+            if (ct.indexOf("action=\"") == -1) {
+                ct = new StringBuilder().append(ct)
+                    .append("; action=").append(action).toString();
+                message.put(Message.CONTENT_TYPE, ct);
+            }
+        }
+    }
+
+    private String getSoapAction(SoapMessage message, BindingOperationInfo boi) {
+        // allow an interceptor to override the SOAPAction if need be
+        String action = (String) message.get(SoapBindingConstants.SOAP_ACTION);
+        
+        // Fall back on the SOAPAction in the operation info
+        if (action == null) {
+            if (boi == null) {
+                action = "\"\"";
+            } else {
+                SoapOperationInfo soi = (SoapOperationInfo) boi.getExtensor(SoapOperationInfo.class);
+                action = soi == null ? "\"\"" : soi.getAction() == null ? "\"\"" : soi.getAction();
+            }
+        }
+        
+        if (!action.startsWith("\"")) {
+            action = new StringBuffer().append("\"").append(action).append("\"").toString();
+        }
+        
+        return action;
+    }
+
 }

Modified: cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapActionInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapActionInterceptorTest.java?rev=683094&r1=683093&r2=683094&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapActionInterceptorTest.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapActionInterceptorTest.java
Tue Aug  5 20:11:20 2008
@@ -24,7 +24,7 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.cxf.binding.soap.interceptor.SoapActionOutInterceptor;
+import org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor;
 import org.apache.cxf.binding.soap.model.SoapOperationInfo;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.message.ExchangeImpl;
@@ -42,7 +42,7 @@
     
     @Test
     public void testSoapAction() throws Exception {
-        SoapActionOutInterceptor i = new SoapActionOutInterceptor();
+        SoapPreProtocolOutInterceptor i = new SoapPreProtocolOutInterceptor();
         
         Message message = new MessageImpl();
         message.setExchange(new ExchangeImpl());
@@ -52,8 +52,9 @@
         assertNotNull(message);
         assertTrue(message instanceof SoapMessage);
         SoapMessage soapMessage = (SoapMessage) message;
+        soapMessage.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
         assertEquals(Soap11.getInstance(), soapMessage.getVersion());
-        (new SoapActionOutInterceptor()).handleMessage(soapMessage);
+        (new SoapPreProtocolOutInterceptor()).handleMessage(soapMessage);
         Map<String, List<String>> reqHeaders = CastUtils.cast((Map)soapMessage.get(Message.PROTOCOL_HEADERS));
         assertNotNull(reqHeaders);
         assertEquals("\"\"", reqHeaders.get(SoapConstants.SOAP_ACTION).get(0));
@@ -61,6 +62,7 @@
         sb.setSoapVersion(Soap12.getInstance());
         soapMessage.clear();
         soapMessage = (SoapMessage) sb.createMessage(soapMessage);
+        soapMessage.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
         i.handleMessage(soapMessage);
         String ct = (String) message.get(Message.CONTENT_TYPE);
         assertEquals("application/soap+xml", ct);

Modified: cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java?rev=683094&r1=683093&r2=683094&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingFactoryTest.java
Tue Aug  5 20:11:20 2008
@@ -154,7 +154,7 @@
         SoapOperationInfo sboi = boi.getExtensor(SoapOperationInfo.class);
         assertNotNull(sboi);
         assertEquals("document", sboi.getStyle());
-        assertEquals("", sboi.getAction());
+        assertEquals("sayHiAction", sboi.getAction());
 
         BindingMessageInfo input = boi.getInput();
         SoapBodyInfo bodyInfo = input.getExtensor(SoapBodyInfo.class);
@@ -168,6 +168,7 @@
         sboi = boi.getExtensor(SoapOperationInfo.class);
         assertNotNull(sboi);
         assertEquals("document", sboi.getStyle());
+        assertEquals("", sboi.getAction());
         Collection<BindingFaultInfo> faults = boi.getFaults();
         assertEquals(1, faults.size());
         BindingFaultInfo faultInfo = boi.getFault(new QName("http://apache.org/hello_world_soap12_http",


Modified: cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=683094&r1=683093&r2=683094&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
Tue Aug  5 20:11:20 2008
@@ -56,7 +56,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.soap.SoapBinding;
-import org.apache.cxf.binding.soap.interceptor.SoapActionOutInterceptor;
+import org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ConduitSelector;
@@ -279,7 +279,7 @@
         }
 
         if (getBinding() instanceof SOAPBinding) {
-            chain.add(new SoapActionOutInterceptor());
+            chain.add(new SoapPreProtocolOutInterceptor());
         }
 
         chain.add(new MessageSenderInterceptor());

Modified: cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java?rev=683094&r1=683093&r2=683094&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
(original)
+++ cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
Tue Aug  5 20:11:20 2008
@@ -39,8 +39,8 @@
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
 import org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor;
-import org.apache.cxf.binding.soap.interceptor.SoapActionOutInterceptor;
 import org.apache.cxf.binding.soap.interceptor.SoapInterceptor;
+import org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
 import org.apache.cxf.endpoint.Endpoint;
@@ -208,7 +208,8 @@
                     // well for outbound case, as many outbound interceptors
                     // have their ending interceptors.
                     // For example, we can not skip MessageSenderInterceptor.
-                    chain.doInterceptStartingAfter(responseMsg, SoapActionOutInterceptor.class.getName());
+                    chain.doInterceptStartingAfter(responseMsg, 
+                                                   SoapPreProtocolOutInterceptor.class.getName());
                 }
 
             } else {

Modified: cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/hello_world_soap12.wsdl
URL: http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/hello_world_soap12.wsdl?rev=683094&r1=683093&r2=683094&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/hello_world_soap12.wsdl (original)
+++ cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/hello_world_soap12.wsdl Tue
Aug  5 20:11:20 2008
@@ -90,7 +90,7 @@
     <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
 	<soap12:binding transport="http://www.w3.org/2003/05/soap/bindings/HTTP/" style="document"
/>
 	<operation name="sayHi">
-	    <soap12:operation style="document" soapAction=""/>
+	    <soap12:operation style="document" soapAction="sayHiAction"/>
 	    <input>
 		<soap12:body use="literal" />
 	    </input>



Mime
View raw message