SOAPFactory factory;
if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapEnvelopeNamespaceURI)) {
factory = new SOAP11Factory();
} else {
factory = new SOAP12Factory();
}
if (attachments.getAttachmentSpecType().equals(
MTOMConstants.MTOM_TYPE)) {
//Creates the MTOM specific MTOMStAXSOAPModelBuilder
builder = new MTOMStAXSOAPModelBuilder(streamReader,
factory,
attachments,
soapEnvelopeNamespaceURI);
} else if (attachments.getAttachmentSpecType().equals(
MTOMConstants.SWA_TYPE)) {
builder = new StAXSOAPModelBuilder(streamReader,
factory,
soapEnvelopeNamespaceURI);
} else if (attachments.getAttachmentSpecType().equals(
MTOMConstants.SWA_TYPE_12)) {
builder = new StAXSOAPModelBuilder(streamReader,
factory,
soapEnvelopeNamespaceURI);
}
} catch (Exception e) {
throw new SOAPException(e);
}
} else {
modifiedInputStream = inputStream;
try {
isReader = new InputStreamReader(modifiedInputStream);
if (HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(contentType)) {
builder = new StAXSOAPModelBuilder(StAXUtils.createXMLStreamReader(isReader),
new SOAP11Factory(),
SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
} else if (HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML.equals(contentType)) {
builder = new StAXSOAPModelBuilder(StAXUtils.createXMLStreamReader(isReader),
new SOAP12Factory(),
SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
} else if (HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED.equals(contentType)) {
builder = new StAXSOAPModelBuilder(StAXUtils.createXMLStreamReader(isReader),
new SOAP11Factory(),