Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DA86C10F2A for ; Thu, 29 May 2014 13:26:02 +0000 (UTC) Received: (qmail 75655 invoked by uid 500); 29 May 2014 13:26:02 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 75601 invoked by uid 500); 29 May 2014 13:26:02 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 75593 invoked by uid 99); 29 May 2014 13:26:02 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 May 2014 13:26:02 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 8BCA34F6B3; Thu, 29 May 2014 13:26:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ningjiang@apache.org To: commits@camel.apache.org Message-Id: <0a4115b7bfef4a15a646099fe2f14035@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: CAMEL-7471 Fixed the issue of SOAP with attachments for CXF_MESSAGE Date: Thu, 29 May 2014 13:26:02 +0000 (UTC) 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 Authored: Thu May 29 21:25:11 2014 +0800 Committer: Willem Jiang 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 attachments = null; boolean isXop = Boolean.valueOf(camelExchange.getProperty(Message.MTOM_ENABLED, String.class)); - for (Map.Entry entry : camelExchange.getIn().getAttachments().entrySet()) { - if (attachments == null) { - attachments = new HashSet(); + 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 entry : camelExchange.getIn().getAttachments().entrySet()) { + if (attachments == null) { + attachments = new HashSet(); + } + 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) {