camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject git commit: CAMEL-7471 Fixed the issue of SOAP with attachments for CXF_MESSAGE
Date Thu, 29 May 2014 13:26:02 GMT
Repository: camel
Updated Branches:
  refs/heads/master 02779d0a6 -> 1ae2a56e8


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/1ae2a56e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1ae2a56e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1ae2a56e

Branch: refs/heads/master
Commit: 1ae2a56e84f33118f03ed64d924d6ec47a16e958
Parents: 02779d0
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Thu May 29 21:25:11 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Thu May 29 21:25:11 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/1ae2a56e/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 270937d..e80c66a 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
@@ -122,13 +122,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) {


Mime
View raw message