Search in sources :

Example 1 with StAXBuilder

use of org.apache.axiom.om.impl.builder.StAXBuilder in project wso2-axis2-transports by wso2.

the class BaseUtils method getEnvelope.

/**
 * Create a SOAP envelope using SOAP 1.1 or 1.2 depending on the namespace
 * @param in InputStream for the payload
 * @param namespace the SOAP namespace
 * @return the SOAP envelope for the correct version
 * @throws javax.xml.stream.XMLStreamException on error
 */
public static SOAPEnvelope getEnvelope(InputStream in, String namespace) throws XMLStreamException {
    try {
        in.reset();
    } catch (IOException ignore) {
    }
    XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(in, MessageContext.DEFAULT_CHAR_SET_ENCODING);
    StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader, namespace);
    return (SOAPEnvelope) builder.getDocumentElement();
}
Also used : StAXBuilder(org.apache.axiom.om.impl.builder.StAXBuilder) XMLStreamReader(javax.xml.stream.XMLStreamReader) StAXSOAPModelBuilder(org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder) IOException(java.io.IOException) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope)

Aggregations

IOException (java.io.IOException)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 StAXBuilder (org.apache.axiom.om.impl.builder.StAXBuilder)1 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)1 StAXSOAPModelBuilder (org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder)1