Repository: camel
Updated Branches:
  refs/heads/camel-2.13.x 0e93424aa -> 933d1ba6d


CAMEL-7471 Fixed the issue of SOAP with attachments for CXF_MESSAGE


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

Branch: refs/heads/camel-2.13.x
Commit: 933d1ba6d5c24cc27b9f67974091aff84fd36fae
Parents: 0e93424
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Thu May 29 21:25:11 2014 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Thu May 29 21:27:58 2014 +0800

----------------------------------------------------------------------
 .../camel/component/cxf/DefaultCxfBinding.java    | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/933d1ba6/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 3bd67e0..4ca79df 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
@@ -121,13 +121,19 @@ public class DefaultCxfBinding implements CxfBinding, 
HeaderFilterStrategyAware
         // propagate attachments
         Set<Attachment> attachments = null;
         boolean isXop = 
Boolean.valueOf(camelExchange.getProperty(Message.MTOM_ENABLED, String.class));
-        for (Map.Entry<String, DataHandler> entry : 
camelExchange.getIn().getAttachments().entrySet()) {
-            if (attachments == null) {
-                attachments = new HashSet<Attachment>();
+        DataFormat dataFormat = 
camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY,  
+                                                          DataFormat.class);
+        // we should avoid adding the attachments if the data format is 
CXFMESSAGE, as the message stream 
+        // already has the attachment information
+        if (!DataFormat.CXF_MESSAGE.equals(dataFormat)) {
+            for (Map.Entry<String, DataHandler> entry : 
camelExchange.getIn().getAttachments().entrySet()) {
+                if (attachments == null) {
+                    attachments = new HashSet<Attachment>();
+                }
+                AttachmentImpl attachment = new AttachmentImpl(entry.getKey(), 
entry.getValue());
+                attachment.setXOP(isXop);
+                attachments.add(attachment);
             }
-            AttachmentImpl attachment = new AttachmentImpl(entry.getKey(), 
entry.getValue());
-            attachment.setXOP(isXop);
-            attachments.add(attachment);
         }
         
         if (attachments != null) {

Reply via email to