MessageFactory fac = MessageFactory.newInstance();
SOAPMessage msg = fac.createMessage();
InputStream inputStream = TestUtils.getTestFile("attach.xml");
AttachmentPart ap = msg.createAttachmentPart(new StreamSource(inputStream), "text/xml");
msg.addAttachmentPart(ap);
msg.saveChanges();
assertNotNull(msg.getMimeHeaders().getHeader(HTTPConstants.HEADER_CONTENT_TYPE));
String contentTypeValue = msg.getMimeHeaders().getHeader(HTTPConstants.HEADER_CONTENT_TYPE)[0];
ContentType contentType = new ContentType(contentTypeValue);
assertNotNull("boundary parameter should exist in the content-type header", contentType.getParameter("boundary"));
//start parameter is not checked, due to it is optional parameter, and seems RI will not add this value