Skip to content

Commit 2c1abc6

Browse files
committed
Adapt deprecated code in Axiom 2
This commit removes the compat module and adapt the deprecated code. See gh-1454
1 parent 60942af commit 2c1abc6

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

spring-ws-core/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ dependencies {
2626
optional("org.apache.ws.commons.axiom:axiom-impl") {
2727
exclude(group: "commons-logging", module: "commons-logging")
2828
}
29-
optional("org.apache.ws.commons.axiom:axiom-compat") {
30-
exclude(group: "commons-logging", module: "commons-logging")
31-
}
3229
optional("org.apache.ws.commons.axiom:axiom-legacy-attachments") {
3330
exclude(group: "commons-logging", module: "commons-logging")
3431
}

spring-ws-core/src/main/java/org/springframework/ws/soap/axiom/AxiomSoapMessageFactory.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.axiom.attachments.Attachments;
3030
import org.apache.axiom.om.OMAbstractFactory;
3131
import org.apache.axiom.om.OMException;
32+
import org.apache.axiom.om.OMXMLBuilderFactory;
3233
import org.apache.axiom.om.impl.MTOMConstants;
3334
import org.apache.axiom.soap.SOAP11Constants;
3435
import org.apache.axiom.soap.SOAP11Version;
@@ -37,8 +38,6 @@
3738
import org.apache.axiom.soap.SOAPFactory;
3839
import org.apache.axiom.soap.SOAPMessage;
3940
import org.apache.axiom.soap.SOAPModelBuilder;
40-
import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder;
41-
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
4241
import org.apache.commons.logging.Log;
4342
import org.apache.commons.logging.LogFactory;
4443

@@ -281,34 +280,33 @@ private boolean isMultiPartRelated(String contentType) {
281280
return contentType.contains(MULTI_PART_RELATED_CONTENT_TYPE);
282281
}
283282

284-
@SuppressWarnings("deprecation")
285-
/** Creates an AxiomSoapMessage without attachments. */
283+
/**
284+
* Creates an AxiomSoapMessage without attachments.
285+
*/
286286
private AxiomSoapMessage createAxiomSoapMessage(InputStream inputStream, String contentType, String soapAction)
287287
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));
291290
SOAPMessage soapMessage = builder.getSOAPMessage();
292291
return new AxiomSoapMessage(soapMessage, soapAction, this.payloadCaching,
293292
this.langAttributeOnSoap11FaultString);
294293
}
295294

296-
@SuppressWarnings("deprecation")
297-
/** Creates an AxiomSoapMessage with attachments. */
295+
/**
296+
* Creates an AxiomSoapMessage with attachments.
297+
*/
298298
private AxiomSoapMessage createMultiPartAxiomSoapMessage(InputStream inputStream, String contentType,
299299
String soapAction) throws XMLStreamException {
300300
Attachments attachments = new Attachments(inputStream, contentType, this.attachmentCaching,
301301
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());
304303
SOAPModelBuilder builder;
305-
String envelopeNamespace = getSoapEnvelopeNamespace(contentType);
306304
if (MTOMConstants.SWA_TYPE.equals(attachments.getAttachmentSpecType())
307305
|| MTOMConstants.SWA_TYPE_12.equals(attachments.getAttachmentSpecType())) {
308-
builder = new StAXSOAPModelBuilder(reader, this.soapFactory, envelopeNamespace);
306+
builder = OMXMLBuilderFactory.createSOAPModelBuilder(attachments.getRootPartInputStream(), charSetEncoding);
309307
}
310308
else if (MTOMConstants.MTOM_TYPE.equals(attachments.getAttachmentSpecType())) {
311-
builder = new MTOMStAXSOAPModelBuilder(reader, attachments, envelopeNamespace);
309+
builder = OMXMLBuilderFactory.createSOAPModelBuilder(attachments.getMultipartBody());
312310
}
313311
else {
314312
throw new AxiomSoapMessageCreationException(

0 commit comments

Comments
 (0)