|
29 | 29 | import org.apache.axiom.attachments.Attachments; |
30 | 30 | import org.apache.axiom.om.OMAbstractFactory; |
31 | 31 | import org.apache.axiom.om.OMException; |
| 32 | +import org.apache.axiom.om.OMXMLBuilderFactory; |
32 | 33 | import org.apache.axiom.om.impl.MTOMConstants; |
33 | 34 | import org.apache.axiom.soap.SOAP11Constants; |
34 | 35 | import org.apache.axiom.soap.SOAP11Version; |
|
37 | 38 | import org.apache.axiom.soap.SOAPFactory; |
38 | 39 | import org.apache.axiom.soap.SOAPMessage; |
39 | 40 | import org.apache.axiom.soap.SOAPModelBuilder; |
40 | | -import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder; |
41 | | -import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; |
42 | 41 | import org.apache.commons.logging.Log; |
43 | 42 | import org.apache.commons.logging.LogFactory; |
44 | 43 |
|
@@ -281,34 +280,33 @@ private boolean isMultiPartRelated(String contentType) { |
281 | 280 | return contentType.contains(MULTI_PART_RELATED_CONTENT_TYPE); |
282 | 281 | } |
283 | 282 |
|
284 | | - @SuppressWarnings("deprecation") |
285 | | - /** Creates an AxiomSoapMessage without attachments. */ |
| 283 | + /** |
| 284 | + * Creates an AxiomSoapMessage without attachments. |
| 285 | + */ |
286 | 286 | private AxiomSoapMessage createAxiomSoapMessage(InputStream inputStream, String contentType, String soapAction) |
287 | 287 | throws XMLStreamException { |
288 | | - XMLStreamReader reader = this.inputFactory.createXMLStreamReader(inputStream, getCharSetEncoding(contentType)); |
289 | | - String envelopeNamespace = getSoapEnvelopeNamespace(contentType); |
290 | | - SOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, this.soapFactory, envelopeNamespace); |
| 288 | + SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(inputStream, |
| 289 | + getCharSetEncoding(contentType)); |
291 | 290 | SOAPMessage soapMessage = builder.getSOAPMessage(); |
292 | 291 | return new AxiomSoapMessage(soapMessage, soapAction, this.payloadCaching, |
293 | 292 | this.langAttributeOnSoap11FaultString); |
294 | 293 | } |
295 | 294 |
|
296 | | - @SuppressWarnings("deprecation") |
297 | | - /** Creates an AxiomSoapMessage with attachments. */ |
| 295 | + /** |
| 296 | + * Creates an AxiomSoapMessage with attachments. |
| 297 | + */ |
298 | 298 | private AxiomSoapMessage createMultiPartAxiomSoapMessage(InputStream inputStream, String contentType, |
299 | 299 | String soapAction) throws XMLStreamException { |
300 | 300 | Attachments attachments = new Attachments(inputStream, contentType, this.attachmentCaching, |
301 | 301 | this.attachmentCacheDir.getAbsolutePath(), Integer.toString(this.attachmentCacheThreshold)); |
302 | | - XMLStreamReader reader = this.inputFactory.createXMLStreamReader(attachments.getRootPartInputStream(), |
303 | | - getCharSetEncoding(attachments.getRootPartContentType())); |
| 302 | + String charSetEncoding = getCharSetEncoding(attachments.getRootPartContentType()); |
304 | 303 | SOAPModelBuilder builder; |
305 | | - String envelopeNamespace = getSoapEnvelopeNamespace(contentType); |
306 | 304 | if (MTOMConstants.SWA_TYPE.equals(attachments.getAttachmentSpecType()) |
307 | 305 | || MTOMConstants.SWA_TYPE_12.equals(attachments.getAttachmentSpecType())) { |
308 | | - builder = new StAXSOAPModelBuilder(reader, this.soapFactory, envelopeNamespace); |
| 306 | + builder = OMXMLBuilderFactory.createSOAPModelBuilder(attachments.getRootPartInputStream(), charSetEncoding); |
309 | 307 | } |
310 | 308 | else if (MTOMConstants.MTOM_TYPE.equals(attachments.getAttachmentSpecType())) { |
311 | | - builder = new MTOMStAXSOAPModelBuilder(reader, attachments, envelopeNamespace); |
| 309 | + builder = OMXMLBuilderFactory.createSOAPModelBuilder(attachments.getMultipartBody()); |
312 | 310 | } |
313 | 311 | else { |
314 | 312 | throw new AxiomSoapMessageCreationException( |
|
0 commit comments