Upgrade to Axiom 1.2.14
Upgraded to Axiom 1.2.14, replacing several deprecated methods with their new replacement (if any), inlined old Axiom code in other places. Also made axiom-impl a runtime dependency (instead of compile).
This commit is contained in:
@@ -105,14 +105,14 @@ class AxiomSoap12Fault extends AxiomSoapFault implements Soap12Fault {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return faultNode.getNodeValue();
|
||||
return faultNode.getFaultNodeValue();
|
||||
}
|
||||
}
|
||||
|
||||
public void setFaultNode(String uri) {
|
||||
try {
|
||||
SOAPFaultNode faultNode = getAxiomFactory().createSOAPFaultNode(getAxiomFault());
|
||||
faultNode.setNodeValue(uri);
|
||||
faultNode.setFaultNodeValue(uri);
|
||||
getAxiomFault().setNode(faultNode);
|
||||
}
|
||||
catch (SOAPProcessingException ex) {
|
||||
|
||||
@@ -18,12 +18,27 @@ package org.springframework.ws.soap.axiom;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
import java.util.Iterator;
|
||||
import javax.activation.DataHandler;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.apache.axiom.attachments.Attachments;
|
||||
import org.apache.axiom.om.OMElement;
|
||||
import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.om.OMOutputFormat;
|
||||
import org.apache.axiom.om.impl.MTOMConstants;
|
||||
import org.apache.axiom.om.impl.OMMultipartWriter;
|
||||
import org.apache.axiom.soap.SOAPBody;
|
||||
import org.apache.axiom.soap.SOAPEnvelope;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPMessage;
|
||||
import org.apache.axiom.soap.SOAPProcessingException;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.ws.mime.Attachment;
|
||||
@@ -38,19 +53,6 @@ import org.springframework.ws.stream.StreamingWebServiceMessage;
|
||||
import org.springframework.ws.transport.TransportConstants;
|
||||
import org.springframework.ws.transport.TransportOutputStream;
|
||||
|
||||
import org.apache.axiom.attachments.Attachments;
|
||||
import org.apache.axiom.om.OMElement;
|
||||
import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.om.OMOutputFormat;
|
||||
import org.apache.axiom.om.impl.MIMEOutputUtils;
|
||||
import org.apache.axiom.om.impl.MTOMConstants;
|
||||
import org.apache.axiom.soap.SOAPBody;
|
||||
import org.apache.axiom.soap.SOAPEnvelope;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPMessage;
|
||||
import org.apache.axiom.soap.SOAPProcessingException;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
/**
|
||||
* AXIOM-specific implementation of the {@link SoapMessage} interface. Created via the {@link AxiomSoapMessageFactory},
|
||||
* wraps a {@link SOAPMessage}.
|
||||
@@ -96,8 +98,8 @@ public class AxiomSoapMessage extends AbstractSoapMessage implements StreamingWe
|
||||
public AxiomSoapMessage(SOAPFactory soapFactory, boolean payloadCaching, boolean langAttributeOnSoap11FaultString) {
|
||||
SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();
|
||||
axiomFactory = soapFactory;
|
||||
axiomMessage = axiomFactory.createSOAPMessage(soapEnvelope.getBuilder());
|
||||
axiomMessage.setSOAPEnvelope(soapEnvelope);
|
||||
axiomMessage = axiomFactory.createSOAPMessage();
|
||||
axiomMessage.setSOAPEnvelope(soapEnvelope);
|
||||
attachments = new Attachments();
|
||||
this.payloadCaching = payloadCaching;
|
||||
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
|
||||
@@ -325,7 +327,25 @@ public class AxiomSoapMessage extends AbstractSoapMessage implements StreamingWe
|
||||
else {
|
||||
envelope.serializeAndConsume(writer, format);
|
||||
}
|
||||
MIMEOutputUtils.writeSOAPWithAttachmentsMessage(writer, outputStream, attachments, format);
|
||||
|
||||
try {
|
||||
OMMultipartWriter mpw = new OMMultipartWriter(outputStream, format);
|
||||
|
||||
Writer rootPartWriter = new OutputStreamWriter(mpw.writeRootPart(),
|
||||
format.getCharSetEncoding());
|
||||
rootPartWriter.write(writer.toString());
|
||||
rootPartWriter.close();
|
||||
|
||||
// Get the collection of ids associated with the attachments
|
||||
for (String id: attachments.getAllContentIDs()) {
|
||||
mpw.writePart(attachments.getDataHandler(id), id);
|
||||
}
|
||||
|
||||
mpw.complete();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new OMException("Error writing SwA message", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
@@ -39,16 +39,17 @@ import org.springframework.ws.transport.TransportConstants;
|
||||
import org.springframework.ws.transport.TransportInputStream;
|
||||
|
||||
import org.apache.axiom.attachments.Attachments;
|
||||
import org.apache.axiom.om.OMAbstractFactory;
|
||||
import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.om.impl.MTOMConstants;
|
||||
import org.apache.axiom.soap.SOAP11Constants;
|
||||
import org.apache.axiom.soap.SOAP11Version;
|
||||
import org.apache.axiom.soap.SOAP12Constants;
|
||||
import org.apache.axiom.soap.SOAP12Version;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPMessage;
|
||||
import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder;
|
||||
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
|
||||
import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory;
|
||||
import org.apache.axiom.soap.impl.llom.soap12.SOAP12Factory;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -99,7 +100,7 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
|
||||
private int attachmentCacheThreshold = 4096;
|
||||
|
||||
// use SOAP 1.1 by default
|
||||
private SOAPFactory soapFactory = new SOAP11Factory();
|
||||
private SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
|
||||
|
||||
private boolean langAttributeOnSoap11FaultString = true;
|
||||
|
||||
@@ -152,10 +153,10 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
|
||||
|
||||
public void setSoapVersion(SoapVersion version) {
|
||||
if (SoapVersion.SOAP_11 == version) {
|
||||
soapFactory = new SOAP11Factory();
|
||||
soapFactory = OMAbstractFactory.getSOAP11Factory();
|
||||
}
|
||||
else if (SoapVersion.SOAP_12 == version) {
|
||||
soapFactory = new SOAP12Factory();
|
||||
soapFactory = OMAbstractFactory.getSOAP12Factory();
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException(
|
||||
@@ -252,8 +253,8 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
|
||||
Attachments attachments =
|
||||
new Attachments(inputStream, contentType, attachmentCaching, attachmentCacheDir.getAbsolutePath(),
|
||||
Integer.toString(attachmentCacheThreshold));
|
||||
XMLStreamReader reader = inputFactory.createXMLStreamReader(attachments.getSOAPPartInputStream(),
|
||||
getCharSetEncoding(attachments.getSOAPPartContentType()));
|
||||
XMLStreamReader reader = inputFactory.createXMLStreamReader(attachments.getRootPartInputStream(),
|
||||
getCharSetEncoding(attachments.getRootPartContentType()));
|
||||
StAXSOAPModelBuilder builder;
|
||||
String envelopeNamespace = getSoapEnvelopeNamespace(contentType);
|
||||
if (MTOMConstants.SWA_TYPE.equals(attachments.getAttachmentSpecType()) ||
|
||||
@@ -334,10 +335,10 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
|
||||
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder("AxiomSoapMessageFactory[");
|
||||
if (soapFactory instanceof SOAP11Factory) {
|
||||
if (soapFactory.getSOAPVersion() == SOAP11Version.getSingleton()) {
|
||||
builder.append("SOAP 1.1");
|
||||
}
|
||||
else if (soapFactory instanceof SOAP12Factory) {
|
||||
else if (soapFactory.getSOAPVersion() == SOAP12Version.getSingleton()) {
|
||||
builder.append("SOAP 1.2");
|
||||
}
|
||||
builder.append(',');
|
||||
|
||||
@@ -21,9 +21,9 @@ import javax.xml.stream.XMLStreamWriter;
|
||||
|
||||
import org.springframework.util.xml.StaxUtils;
|
||||
|
||||
import org.apache.axiom.om.OMAbstractFactory;
|
||||
import org.apache.axiom.soap.SOAPBody;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class NonCachingPayloadTest {
|
||||
|
||||
@Before
|
||||
public final void setUp() {
|
||||
SOAPFactory soapFactory = new SOAP11Factory();
|
||||
SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
|
||||
body = soapFactory.createSOAPBody();
|
||||
payload = new NonCachingPayload(body, soapFactory);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ import org.apache.axiom.soap.SOAP11Constants;
|
||||
import org.apache.axiom.soap.SOAPEnvelope;
|
||||
import org.apache.axiom.soap.SOAPMessage;
|
||||
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
|
||||
import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory;
|
||||
import org.custommonkey.xmlunit.XMLUnit;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
@@ -118,7 +117,7 @@ public class AxiomUtilsTest {
|
||||
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
|
||||
XMLStreamReader reader = inputFactory.createXMLStreamReader(resource.getInputStream());
|
||||
StAXSOAPModelBuilder builder =
|
||||
new StAXSOAPModelBuilder(reader, new SOAP11Factory(), SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
|
||||
new StAXSOAPModelBuilder(reader, OMAbstractFactory.getSOAP11Factory(), SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
|
||||
SOAPMessage soapMessage = builder.getSoapMessage();
|
||||
|
||||
Document result = AxiomUtils.toDocument(soapMessage.getSOAPEnvelope());
|
||||
@@ -145,4 +144,4 @@ public class AxiomUtilsTest {
|
||||
|
||||
assertXMLEqual("Invalid SOAPEnvelope generated from document", expected, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.ws.commons.axiom</groupId>
|
||||
<artifactId>axiom-api</artifactId>
|
||||
<version>1.2.13</version>
|
||||
<version>1.2.14</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
@@ -480,7 +480,8 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.ws.commons.axiom</groupId>
|
||||
<artifactId>axiom-impl</artifactId>
|
||||
<version>1.2.13</version>
|
||||
<version>1.2.14</version>
|
||||
<scope>runtime</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
|
||||
Reference in New Issue
Block a user