This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch camel-2.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
     new cf24509  [CAMEL-12465]Don't carry soapAction forward if operationName 
is specified explicitly for the CxfProducer
cf24509 is described below

commit cf24509c343b2109f0b1a564dbd408de89a39ebf
Author: Freeman Fang <freeman.f...@gmail.com>
AuthorDate: Mon Apr 23 14:38:09 2018 +0800

    [CAMEL-12465]Don't carry soapAction forward if operationName is specified 
explicitly for the CxfProducer
    
    (cherry picked from commit e1e36dba66d4bf4a3a22d1f0cfa9c5c3af7f10cf)
---
 .../apache/camel/component/cxf/DefaultCxfBinding.java  |  5 ++++-
 .../camel/component/cxf/DefaultCxfBindingTest.java     | 18 ++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
index 088ee71..c5d1db3 100644
--- 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
+++ 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
@@ -738,7 +738,10 @@ public class DefaultCxfBinding implements CxfBinding, 
HeaderFilterStrategyAware
             // from the previous request or response propagated with the 
invocation context
             cxfContext.remove(Message.PROTOCOL_HEADERS);
         }
-        cxfContext.put(SoapBindingConstants.SOAP_ACTION, 
camelHeaders.get(SoapBindingConstants.SOAP_ACTION));
+        if (camelHeaders.get(CxfConstants.OPERATION_NAMESPACE) == null
+            && camelHeaders.get(CxfConstants.OPERATION_NAME) == null) {
+            cxfContext.put(SoapBindingConstants.SOAP_ACTION, 
camelHeaders.get(SoapBindingConstants.SOAP_ACTION));
+        }
     }
 
     protected static Object getContentFromCxf(Message message, DataFormat 
dataFormat, String encoding) {
diff --git 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/DefaultCxfBindingTest.java
 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/DefaultCxfBindingTest.java
index 8b07634..c3b3e9d 100644
--- 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/DefaultCxfBindingTest.java
+++ 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/DefaultCxfBindingTest.java
@@ -205,6 +205,24 @@ public class DefaultCxfBindingTest extends Assert {
     }
     
     @Test
+    public void 
testPopulateCxfSoapHeaderRequestFromExchangeWithExplicitOperationName() {
+        DefaultCxfBinding cxfBinding = new DefaultCxfBinding();
+        cxfBinding.setHeaderFilterStrategy(new DefaultHeaderFilterStrategy());
+        Exchange exchange = new DefaultExchange(context);
+        org.apache.cxf.message.Exchange cxfExchange = new 
org.apache.cxf.message.ExchangeImpl();
+        Map<String, Object> requestContext = new HashMap<>();
+
+        String expectedSoapActionHeader = "urn:hello:world";
+        exchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, 
"http://test123";);
+        exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, 
"testOperation");
+
+        cxfBinding.populateCxfRequestFromExchange(cxfExchange, exchange, 
requestContext);
+
+        String actualSoapActionHeader = 
(String)requestContext.get(SoapBindingConstants.SOAP_ACTION);
+        assertNull(actualSoapActionHeader);
+    }
+    
+    @Test
     public void testPopupalteExchangeFromCxfResponse() {
         DefaultCxfBinding cxfBinding = new DefaultCxfBinding();
         cxfBinding.setHeaderFilterStrategy(new DefaultHeaderFilterStrategy());

-- 
To stop receiving notification emails like this one, please contact
ff...@apache.org.

Reply via email to