AxiomUtils.toEnveloper now using StAXUtils

Previously, AxiomUtils.toEnvelope() constructed its own XMLInputFactory
for creating a XMLStreamReader. Now we use Axiom's StAXUtils instead,
thus allowing users to use the standard Axiom mechanisms for setting
STAX properties etc.

Issue: SWS-851
This commit is contained in:
Arjen Poutsma
2014-01-27 12:42:57 +01:00
parent b12a3e63a1
commit 1c1db7d914

View File

@@ -34,6 +34,7 @@ import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
import org.w3c.dom.DOMImplementation;
@@ -161,8 +162,10 @@ public abstract class AxiomUtils {
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
StAXSOAPModelBuilder stAXSOAPModelBuilder =
new StAXSOAPModelBuilder(XMLInputFactory.newInstance().createXMLStreamReader(bis), null);
XMLInputFactory inputFactory = StAXUtils.getXMLInputFactory();
StAXSOAPModelBuilder stAXSOAPModelBuilder =
new StAXSOAPModelBuilder(inputFactory.createXMLStreamReader(bis), null);
SOAPEnvelope envelope = stAXSOAPModelBuilder.getSOAPEnvelope();
// Necessary to build a correct Axiom tree, see SWS-483