InputStream inStream = getTestResource(inFileName);
Attachments attachments = new Attachments(inStream, contentTypeString);
XMLStreamReader reader = XMLInputFactory.newInstance()
.createXMLStreamReader(new BufferedReader(new InputStreamReader(attachments
.getSOAPPartInputStream())));
OMXMLParserWrapper builder = new MTOMStAXSOAPModelBuilder(reader, attachments,
SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
OMElement root = builder.getDocumentElement();
OMOutputFormat format = new OMOutputFormat();
format.setDoOptimize(false);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
root.serializeAndConsume(baos, format);