public static org.apache.axiom.soap.SOAPEnvelope getSOAPEnvelopeFromDOOMDocument(org.w3c.dom.Document doc) { return OMXMLBuilderFactory.createStAXSOAPModelBuilder(((OMElement)doc.getDocumentElement()).getXMLStreamReader()).getSOAPEnvelope(); }
public static org.apache.axiom.soap.SOAPEnvelope toOMSOAPEnvelope(org.w3c.dom.Element elem) { return OMXMLBuilderFactory.createStAXSOAPModelBuilder(((OMElement)elem).getXMLStreamReader()).getSOAPEnvelope(); }
private SOAPEnvelope getSOAPEnvFromOM(OMElement inlineElement) { return OMXMLBuilderFactory.createStAXSOAPModelBuilder( inlineElement.getXMLStreamReader()).getSOAPEnvelope(); }
protected void assertSOAPEchoResponse(String textValue, XMLStreamReader reader) { SOAPEnvelope env = OMXMLBuilderFactory.createStAXSOAPModelBuilder(reader).getSOAPEnvelope(); assertEchoResponse(textValue, env.getBody().getFirstElement()); }
/** * 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(); } }
/** * Create a DOM Document using the org.apache.axiom.soap.SOAPEnvelope * * @param env An org.apache.axiom.soap.SOAPEnvelope instance * @return the org.apache.axis2.soap.impl.dom.SOAPEnvelopeImpl of the given SOAP Envelope */ public static Element toDOOMSOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope env) { return (Element)OMXMLBuilderFactory.createStAXSOAPModelBuilder( OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM), env.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(); }
public void setContent(Source source) throws SOAPException { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLStreamReader reader; if (source instanceof StreamSource) { reader = inputFactory.createXMLStreamReader(source); } else { Result result = new StreamResult(baos); Transformer xformer = TransformerFactory.newInstance().newTransformer(); xformer.transform(source, result); InputStream is = new ByteArrayInputStream(baos.toByteArray()); reader = inputFactory.createXMLStreamReader(is); } SOAPModelBuilder builder1 = OMXMLBuilderFactory.createStAXSOAPModelBuilder( envelope.omTarget.getOMFactory().getMetaFactory(), reader); envelope = new SOAPEnvelopeImpl(builder1.getSOAPEnvelope()); envelope.omTarget.build(); this.document = envelope.getOwnerDocument(); envelope.setSOAPPartParent(this); } catch (TransformerFactoryConfigurationError e) { log.error(e); throw new SOAPException(e); } catch (Exception e) { log.error(e); throw new SOAPException(e); } }
SOAPModelBuilder stAXSOAPModelBuilder = OMXMLBuilderFactory.createStAXSOAPModelBuilder( reader); SOAPEnvelope envelope = stAXSOAPModelBuilder.getSOAPEnvelope();
public OMElement getNode(Charset charset) { try { out.close(); } catch (IOException e) { handleException("Error while closing output stream", e); } if (expectedOutput == ResultBuilderFactory.Output.TEXT) { return TextFileDataSource.createOMSourcedElement(tmp, charset); } else { XMLStreamReader reader; try { reader = StAXUtils.createXMLStreamReader(tmp.getInputStream()); } catch (XMLStreamException e) { handleException("Unable to parse the XML output", e); return null; } catch (IOException e) { handleException("I/O error while reading temporary file", e); return null; } if (expectedOutput == ResultBuilderFactory.Output.SOAP_ENVELOPE) { return OMXMLBuilderFactory.createStAXSOAPModelBuilder(reader).getSOAPEnvelope(); } else { return OMXMLBuilderFactory.createStAXOMBuilder(reader).getDocumentElement(); } } }