data = bout.toByteArray();
}
catch (Exception e)
{
throw new WSException("Failed to inline XOP data", e);
}
// create base64 contents
String base64 = SimpleTypeBindings.marshalBase64(data);
parent.removeChild(xopIncludeElement);
parent.setValue(base64);
parent.setUserData(NS_XOP_JBOSSWS_CONTENT_TYPE, contentType, null);
if (log.isDebugEnabled())
log.debug("Created base64 representation for content-type " + contentType);
// cleanup the attachment part
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
if (cid.startsWith("cid:"))
cid = cid.substring(4);
cid = '<' + cid + '>';
AttachmentPart removedPart = soapMessage.removeAttachmentByContentId(cid);
if (null == removedPart)
throw new WSException("Unable to remove attachment part " + cid);
if (log.isDebugEnabled())
log.debug("Removed attachment part " + cid);
// leave soap object model in a valid state