Author: veithen Date: Mon Apr 30 17:39:32 2012 New Revision: 1332311 URL: http://svn.apache.org/viewvc?rev=1332311&view=rev Log: AXIS2-5308: In the SwA case, remove the root part from the Attachments object before adding it to the message context, so that the Attachments object in the message context always contains attachment parts only (both for incoming and for outgoing messages).
Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/builder/SOAPBuilder.java Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/builder/SOAPBuilder.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/builder/SOAPBuilder.java?rev=1332311&r1=1332310&r2=1332311&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/builder/SOAPBuilder.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/builder/SOAPBuilder.java Mon Apr 30 17:39:32 2012 @@ -63,8 +63,6 @@ public class SOAPBuilder implements MIME public OMElement processMIMEMessage(Attachments attachments, String contentType, MessageContext messageContext) throws AxisFault { - messageContext.setAttachmentMap(attachments); - String charSetEncoding = BuilderUtil.getCharSetEncoding(attachments.getRootPartContentType()); if (charSetEncoding == null) { @@ -74,7 +72,12 @@ public class SOAPBuilder implements MIME charSetEncoding); messageContext.setDoingSwA(true); + + InputStream in = attachments.getRootPartInputStream(false); + // Only the attachment parts should be accessible; remove the root part + attachments.removeDataHandler(attachments.getRootPartContentID()); + messageContext.setAttachmentMap(attachments); - return processDocument(attachments.getRootPartInputStream(false), contentType, messageContext); + return processDocument(in, contentType, messageContext); } }