camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject camel git commit: [CAMEL-9246]camel-cxf proxy with MTOM does not get attachment back when RPC/literal style WSDL used
Date Mon, 16 Nov 2015 06:23:16 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x 61ad899b6 -> b471d78f8


[CAMEL-9246]camel-cxf proxy with MTOM does not get attachment back when RPC/literal style
WSDL used


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

Branch: refs/heads/camel-2.15.x
Commit: b471d78f831859ef61034a7fb112fb36972572b5
Parents: 61ad899
Author: Freeman Fang <freeman.fang@gmail.com>
Authored: Mon Nov 16 14:23:00 2015 +0800
Committer: Freeman Fang <freeman.fang@gmail.com>
Committed: Mon Nov 16 14:23:00 2015 +0800

----------------------------------------------------------------------
 .../camel/component/cxf/DefaultCxfBinding.java  | 34 ++++++++++----------
 .../cxf/mtom/CxfMtomPOJOProducerTest.java       |  3 +-
 2 files changed, 18 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b471d78f/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 251728d..273654c 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
@@ -180,8 +180,8 @@ public class DefaultCxfBinding implements CxfBinding, HeaderFilterStrategyAware
         DataFormat dataFormat = camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY,
 
                                                           DataFormat.class);
         boolean isXop = Boolean.valueOf(camelExchange.getProperty(Message.MTOM_ENABLED, String.class));
-        // propagate attachments if the data format is not POJO with MTOM enabled
-        if (cxfMessage.getAttachments() != null && !(DataFormat.POJO.equals(dataFormat)
&& isXop)) {
+        // propagate attachments
+        if (cxfMessage.getAttachments() != null) {
             // propagate attachments
             for (Attachment attachment : cxfMessage.getAttachments()) {
                 camelExchange.getOut().addAttachment(attachment.getId(), attachment.getDataHandler());
@@ -379,23 +379,23 @@ public class DefaultCxfBinding implements CxfBinding, HeaderFilterStrategyAware
             return;
         }
         
-        // propagate attachments if the data format is not POJO
-        if (!DataFormat.POJO.equals(dataFormat)) {
-            Set<Attachment> attachments = null;
-            boolean isXop = Boolean.valueOf(camelExchange.getProperty(Message.MTOM_ENABLED,
String.class));
-            for (Map.Entry<String, DataHandler> entry : camelExchange.getOut().getAttachments().entrySet())
{
-                if (attachments == null) {
-                    attachments = new HashSet<Attachment>();
-                }
-                AttachmentImpl attachment = new AttachmentImpl(entry.getKey(), entry.getValue());
-                attachment.setXOP(isXop); 
-                attachments.add(attachment);
-            }
-            
-            if (attachments != null) {
-                outMessage.setAttachments(attachments);
+        // propagate attachments
+        
+        Set<Attachment> attachments = null;
+        boolean isXop = Boolean.valueOf(camelExchange.getProperty(Message.MTOM_ENABLED, String.class));
+        for (Map.Entry<String, DataHandler> entry : camelExchange.getOut().getAttachments().entrySet())
{
+            if (attachments == null) {
+                attachments = new HashSet<Attachment>();
             }
+            AttachmentImpl attachment = new AttachmentImpl(entry.getKey(), entry.getValue());
+            attachment.setXOP(isXop);
+            attachments.add(attachment);
         }
+
+        if (attachments != null) {
+            outMessage.setAttachments(attachments);
+        }
+        
        
         BindingOperationInfo boi = cxfExchange.get(BindingOperationInfo.class);
         if (boi != null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/b471d78f/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomPOJOProducerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomPOJOProducerTest.java
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomPOJOProducerTest.java
index 5df1ff0..a8e0f0d 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomPOJOProducerTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomPOJOProducerTest.java
@@ -87,8 +87,7 @@ public class CxfMtomPOJOProducerTest extends AbstractJUnit4SpringContextTests
{
             
         });
         
-        // Make sure we don't put the attachement into out message
-        assertEquals("The attachement size should be 0 ", 0, exchange.getOut().getAttachments().size());
+        assertEquals("The attachement size should be 2 ", 2, exchange.getOut().getAttachments().size());
         
         Object[] result = exchange.getOut().getBody(Object[].class);
         Holder<byte[]> photo1 = (Holder<byte[]>) result[1];


Mime
View raw message