You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/11/07 19:25:17 UTC

[3/4] camel git commit: CAMEL-10449 - Set CXF SoapAction header correctly

CAMEL-10449 - Set CXF SoapAction header correctly


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bb1803c8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bb1803c8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bb1803c8

Branch: refs/heads/camel-2.18.x
Commit: bb1803c8b799713d24169b642bdf756f3479aa8c
Parents: 7530b37
Author: jpoth <po...@gmail.com>
Authored: Mon Nov 7 15:30:54 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Nov 7 20:24:58 2016 +0100

----------------------------------------------------------------------
 .../camel/component/cxf/DefaultCxfBinding.java    |  1 +
 .../component/cxf/DefaultCxfBindingTest.java      | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bb1803c8/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
----------------------------------------------------------------------
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 de771da..89acf0f 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
@@ -728,6 +728,7 @@ 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));
     }
 
     protected static Object getContentFromCxf(Message message, DataFormat dataFormat, String encoding) {

http://git-wip-us.apache.org/repos/asf/camel/blob/bb1803c8/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/DefaultCxfBindingTest.java
----------------------------------------------------------------------
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 a700832..2ef1fd8 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
@@ -45,6 +45,7 @@ import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.util.IOHelper;
 import org.apache.cxf.attachment.AttachmentImpl;
 import org.apache.cxf.binding.Binding;
+import org.apache.cxf.binding.soap.SoapBindingConstants;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.helpers.CastUtils;
@@ -184,6 +185,23 @@ public class DefaultCxfBindingTest extends Assert {
         assertEquals("att-1", att.getId());
         assertEquals("value 1", att.getHeader("attachment-header"));
     }
+
+    @Test
+    public void testPopulateCxfSoapHeaderRequestFromExchange() {
+        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("soapAction", expectedSoapActionHeader);
+
+        cxfBinding.populateCxfRequestFromExchange(cxfExchange, exchange, requestContext);
+
+        String actualSoapActionHeader = (String)requestContext.get(SoapBindingConstants.SOAP_ACTION);
+        assertEquals(expectedSoapActionHeader,actualSoapActionHeader);
+    }
     
     @Test
     public void testPopupalteExchangeFromCxfResponse() {