// Add any new attachments from the SOAPMessage to this Message
Iterator it = soapMessage.getAttachments();
while (it.hasNext()) {
AttachmentPart ap = (AttachmentPart) it.next();
String cid = ap.getContentId();
if (log.isDebugEnabled()) {
log.debug(" add SOAPMessage attachment to Message. cid = " + cid);
}
addDataHandler(ap.getDataHandler(), cid);
dontCopy.add(cid);
}
// Add the attachments from this Message to the SOAPMessage
for (String cid:getAttachmentIDs()) {
DataHandler dh = attachments.getDataHandler(cid);
if (!dontCopy.contains(cid)) {
if (log.isDebugEnabled()) {
log.debug(" add Message attachment to SoapMessage. cid = " + cid);
}
AttachmentPart ap = MessageUtils.createAttachmentPart(cid, dh, soapMessage);
soapMessage.addAttachmentPart(ap);
}
}
if (log.isDebugEnabled()) {
log.debug(" The SOAPMessage has the following attachments");
Iterator it2 = soapMessage.getAttachments();
while (it2.hasNext()) {
AttachmentPart ap = (AttachmentPart) it2.next();
log.debug(" AttachmentPart cid=" + ap.getContentId());
log.debug(" contentType =" + ap.getContentType());
}
}
if (log.isDebugEnabled()) {
log.debug("end getAsSOAPMessage");