XMLStreamReader xmlreader = null;
try {
if (persistedWithOptimizedMTOM) {
boolean isSOAP = true;
StAXBuilder builder = BuilderUtil
.getAttachmentsBuilder(this, msgBuffer, contentType, isSOAP);
envelope = (SOAPEnvelope) builder.getDocumentElement();
// build the OM in order to free the input stream
envelope.buildWithAttachments();
} else {
xmlreader = StAXUtils.createXMLStreamReader(msgBuffer, charSetEnc);
StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader, namespaceURI);
envelope = (SOAPEnvelope) builder.getDocumentElement();
// build the OM in order to free the input stream
envelope.build();
}
}
catch (Exception ex) {