/** * Converts a given {@link Document} to an AXIOM {@link org.apache.axiom.soap.SOAPEnvelope}. * * @param document the document to be converted * @return the converted envelope * @throws IllegalArgumentException in case of errors */ public static SOAPEnvelope toEnvelope(Document document) { return OMXMLBuilderFactory.createSOAPModelBuilder(new DOMSource(document)).getSOAPEnvelope(); }
/** * 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(); } }
@SuppressWarnings("deprecation") /** Creates an AxiomSoapMessage without attachments. */ private AxiomSoapMessage createAxiomSoapMessage(InputStream inputStream, String contentType, String soapAction) throws XMLStreamException { XMLStreamReader reader = inputFactory.createXMLStreamReader(inputStream, getCharSetEncoding(contentType)); String envelopeNamespace = getSoapEnvelopeNamespace(contentType); SOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, soapFactory, envelopeNamespace); SOAPMessage soapMessage = builder.getSOAPMessage(); return new AxiomSoapMessage(soapMessage, soapAction, payloadCaching, langAttributeOnSoap11FaultString); }
public OMElement processMIMEMessage(Attachments attachments, String contentType, MessageContext messageContext) throws AxisFault { try { // TODO: this will be changed later (see AXIS2-5308) messageContext.setAttachmentMap(attachments); SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(attachments); OMDocument document = builder.getDocument(); String charsetEncoding = document.getCharsetEncoding(); if (charsetEncoding == null) { charsetEncoding = MessageContext.UTF_8; } messageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charsetEncoding); SOAPEnvelope envelope = (SOAPEnvelope)document.getOMDocumentElement(); // TODO: Axiom should take care of this, but we need to validate that // BuilderUtil // .validateSOAPVersion(BuilderUtil.getEnvelopeNamespace(contentType), envelope); // BuilderUtil.validateCharSetEncoding(charSetEncoding, builder.getDocument() // .getCharsetEncoding(), envelope.getNamespace().getNamespaceURI()); messageContext.setDoingMTOM(true); return envelope; } catch (OMException e) { throw AxisFault.makeFault(e); } } }
OMDocument document = builder.getDocument(); String charsetEncoding = document.getCharsetEncoding(); if (charsetEncoding == null) {
/** * Converts a given {@link Document} to an AXIOM {@link org.apache.axiom.soap.SOAPEnvelope}. * * @param document the document to be converted * @return the converted envelope * @throws IllegalArgumentException in case of errors */ public static SOAPEnvelope toEnvelope(Document document) { return OMXMLBuilderFactory.createSOAPModelBuilder(new DOMSource(document)).getSOAPEnvelope(); }
@SuppressWarnings("deprecation") /** Creates an AxiomSoapMessage without attachments. */ private AxiomSoapMessage createAxiomSoapMessage(InputStream inputStream, String contentType, String soapAction) throws XMLStreamException { XMLStreamReader reader = inputFactory.createXMLStreamReader(inputStream, getCharSetEncoding(contentType)); String envelopeNamespace = getSoapEnvelopeNamespace(contentType); SOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, soapFactory, envelopeNamespace); SOAPMessage soapMessage = builder.getSOAPMessage(); return new AxiomSoapMessage(soapMessage, soapAction, payloadCaching, langAttributeOnSoap11FaultString); }
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; }
/** * Converts a given {@link Document} to an AXIOM {@link org.apache.axiom.soap.SOAPEnvelope}. * * @param document the document to be converted * @return the converted envelope * @throws IllegalArgumentException in case of errors */ public static SOAPEnvelope toEnvelope(Document document) { return OMXMLBuilderFactory.createSOAPModelBuilder(new DOMSource(document)).getSOAPEnvelope(); }
@SuppressWarnings("deprecation") /** Creates an AxiomSoapMessage without attachments. */ private AxiomSoapMessage createAxiomSoapMessage(InputStream inputStream, String contentType, String soapAction) throws XMLStreamException { XMLStreamReader reader = inputFactory.createXMLStreamReader(inputStream, getCharSetEncoding(contentType)); String envelopeNamespace = getSoapEnvelopeNamespace(contentType); SOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, soapFactory, envelopeNamespace); SOAPMessage soapMessage = builder.getSOAPMessage(); return new AxiomSoapMessage(soapMessage, soapAction, payloadCaching, langAttributeOnSoap11FaultString); }
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; }
public static org.apache.axiom.soap.SOAPEnvelope getSOAPEnvelopeFromDOOMDocument(org.w3c.dom.Document doc) { return OMXMLBuilderFactory.createStAXSOAPModelBuilder(((OMElement)doc.getDocumentElement()).getXMLStreamReader()).getSOAPEnvelope(); }
/** * Create a DOM Document using the org.apache.axiom.soap.SOAPEnvelope * * @param env An org.apache.axiom.soap.SOAPEnvelope instance * @return the DOM Document of the given SOAP Envelope */ public static Document getDocumentFromSOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope env) { return (Document)OMXMLBuilderFactory.createStAXSOAPModelBuilder( OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM), env.getXMLStreamReader()).getSOAPMessage(); }
InputStream inputStream = request.getInputStream(); SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(inputStream, "UTF-8"); reqEnv = (SOAPEnvelope) builder.getDocumentElement();
private SOAPEnvelope getSOAPEnvFromOM(OMElement inlineElement) { return OMXMLBuilderFactory.createStAXSOAPModelBuilder( inlineElement.getXMLStreamReader()).getSOAPEnvelope(); }
@Override public void setDocument(Document document) { // save the Soap Action String soapAction = getSoapAction(); // replace the Axiom message setAxiomMessage(OMXMLBuilderFactory.createSOAPModelBuilder(axiomFactory.getMetaFactory(), new DOMSource(document)).getSOAPMessage()); // restore the Soap Action setSoapAction(soapAction); }
public static org.apache.axiom.soap.SOAPEnvelope toOMSOAPEnvelope(org.w3c.dom.Element elem) { return OMXMLBuilderFactory.createStAXSOAPModelBuilder(((OMElement)elem).getXMLStreamReader()).getSOAPEnvelope(); }
@Override public void setDocument(Document document) { // save the Soap Action String soapAction = getSoapAction(); // replace the Axiom message setAxiomMessage(OMXMLBuilderFactory.createSOAPModelBuilder(axiomFactory.getMetaFactory(), new DOMSource(document)).getSOAPMessage()); // restore the Soap Action setSoapAction(soapAction); }
SOAPEnvelope envelope = OMXMLBuilderFactory.createSOAPModelBuilder(new StringReader(payload)).getSOAPEnvelope();
@Override public void setDocument(Document document) { // save the Soap Action String soapAction = getSoapAction(); // replace the Axiom message setAxiomMessage(OMXMLBuilderFactory.createSOAPModelBuilder(axiomFactory.getMetaFactory(), new DOMSource(document)).getSOAPMessage()); // restore the Soap Action setSoapAction(soapAction); }