InputStreamReader isReader = null;
if (contentType.indexOf("multipart/related") == 0) {
//This contains attachements
try {
Attachments attachments =
new Attachments(inputStream, fullContentTypeStr, false, "", "");
modifiedInputStream = attachments.getSOAPPartInputStream();
isReader = new InputStreamReader(modifiedInputStream);
String soapEnvelopeNamespaceURI =
BuilderUtil.getEnvelopeNamespace(fullContentTypeStr);
String charSetEncoding =
BuilderUtil.getCharSetEncoding(attachments.getSOAPPartContentType());
XMLStreamReader streamReader =
StAXUtils.createXMLStreamReader(BuilderUtil.getReader(
attachments.getSOAPPartInputStream(), charSetEncoding));
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);
}