Map<String,DataHandler> attachmentsMap = new LinkedHashMap<String,DataHandler>();
for (AttachmentPart ap : attachmentParts) {
attachmentsMap.put(ap.getContentId(), ap.getDataHandler());
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
envelope.serialize(baos);
String contentType =
(format.isSOAP11() ? SOAP11Constants.SOAP_11_CONTENT_TYPE :
SOAP12Constants.SOAP_12_CONTENT_TYPE)
+ "; charset=" + format.getCharSetEncoding();
DataHandler rootDataHandler =