/** * Returns a OMElement handler to the document element of the Fast Infoset message. * * @param inputStream InputStream to the message * @param contentType Content type of the message * @param messageContext MessageContext to be used * * @return OMElement handler to the document element * * @see org.apache.axis2.builder.Builder#processDocument(InputStream, String, MessageContext) */ public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault { if (logger.isDebugEnabled()) { logger.debug("Processing a Document with the content type: " + contentType); } //Create a instance of the StAX Parser which can handle the fast infoset stream SOAPModelBuilder builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(new StAXDocumentParser(inputStream)); messageContext.setProperty(Constants.BUILDER, builder); return builder.getDocumentElement(); } }
private static OMElement createDefaultDocumentElement(MessageContext msgContext, InputStream inStream, String type) { OMElement documentElement; if (msgContext.isDoingREST()) { if (log.isDebugEnabled()) { log.debug("Could not find a Builder for type (" + type + "). Using REST."); } OMXMLParserWrapper builder = BuilderUtil.createPOXBuilder(inStream, null); documentElement = builder.getDocumentElement(); } else { // FIXME making soap defualt for the moment..might effect the // performance if (log.isDebugEnabled()) { log.debug("Could not find a Builder for type (" + type + "). Using SOAP."); } String charSetEnc = (String) msgContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); SOAPModelBuilder builder = BuilderUtil.createSOAPModelBuilder(inStream, charSetEnc); documentElement = builder.getDocumentElement(); } return documentElement; }
private static OMElement createDefaultDocumentElement(MessageContext msgContext, InputStream inStream, String type) { OMElement documentElement; if (msgContext.isDoingREST()) { if (log.isDebugEnabled()) { log.debug("Could not find a Builder for type (" + type + "). Using REST."); } OMXMLParserWrapper builder = BuilderUtil.createPOXBuilder(inStream, null); documentElement = builder.getDocumentElement(); } else { // FIXME making soap defualt for the moment..might effect the // performance if (log.isDebugEnabled()) { log.debug("Could not find a Builder for type (" + type + "). Using SOAP."); } String charSetEnc = (String) msgContext .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING); SOAPModelBuilder builder = BuilderUtil.createSOAPModelBuilder(inStream, charSetEnc); documentElement = builder.getDocumentElement(); } return documentElement; }
InputStream inputStream = request.getInputStream(); SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(inputStream, "UTF-8"); reqEnv = (SOAPEnvelope) builder.getDocumentElement();