msg1.addAttachmentPart(attachment1);
if (msg1.saveRequired())
msg1.saveChanges();
MultipartRelatedXOPEncoder mrxe = new MultipartRelatedXOPEncoder( (SOAPMessageImpl) msg1);
mrxe.encodeMultipartRelatedMessage();
ByteArrayOutputStream out = new ByteArrayOutputStream();
mrxe.writeTo(out);
if ( ! out.toString().contains("Content-Type: application/xop+xml; charset=UTF-8; type=\"text/xml\""))
fail("Content-Type does not contain charset=UTF-8");
}