Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMXMLParserWrapper


    }
    return getStAXPayload(mc.getEnvelope());
  }

  public static void setStAXPayload(SOAPEnvelope envelope, XMLStreamReader streamReader) {
    OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(envelope.getOMFactory(), streamReader);
    OMElement el = builder.getDocumentElement();
    setXMLPayload(envelope, el);
  }
View Full Code Here


                // TODO: don't know why this is here, but without it some unit tests fail...
                OMDocument omDoc = OMAbstractFactory.getSOAP11Factory().createOMDocument();
                omDoc.addChild(envelope);
               
                SOAPBody body = envelope.getBody();
                OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(parser);
                OMElement bodyElement = builder.getDocumentElement();
                if (addTextAroundBody) {
                    OMFactory fac = OMAbstractFactory.getOMFactory();
                    body.addChild(fac.createOMText("\n"));
                    body.addChild(bodyElement);
                    body.addChild(fac.createOMText("\n"));
View Full Code Here

        fac.createOMElement(
                new QName("http://schemas.xmlsoap.org/ws/2005/02/trust", "Entropy", "wst"),
                elem);
        String xml = elem.toString();

        OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(),
                new ByteArrayInputStream(xml.getBytes()));

        builder.getDocumentElement().build();

        // The StAX implementation may or may not have a trailing blank in the tag
        String assertText1 =
                "<wst:Entropy xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\" />";
        String assertText2 =
View Full Code Here

     * @throws Exception
     */
    protected SOAPEnvelope createEnvelope(InputStream is) throws Exception {
        XMLStreamReader parser =
            XMLInputFactory.newInstance().createXMLStreamReader(is);
        OMXMLParserWrapper builder = new StAXSOAPModelBuilder(omMetaFactory, parser, null);
        SOAPEnvelope sourceEnv = (SOAPEnvelope) builder.getDocumentElement();
        return sourceEnv;
    }
View Full Code Here

     * @return The qname of the first element in the body or null
     */
    private QName getPayloadQName_Optimized() {
        // The parser may expose a SOAPBODY_FIRST_CHILD_ELEMENT_QNAME property
        // Use that QName to determine if there is a fault
        OMXMLParserWrapper builder = this.getBuilder();
        if (builder instanceof StAXSOAPModelBuilder) {
            try {
                QName payloadQName = (QName) ((StAXSOAPModelBuilder) builder).
                    getReaderProperty(SOAPConstants.SOAPBODY_FIRST_CHILD_ELEMENT_QNAME);
                return payloadQName;
View Full Code Here

    public static XMLStreamReader getXMLStreamReader(IContainer container, boolean cache) {
        return getXMLStreamReader(container, cache, defaultReaderConfiguration);
    }
   
    public static XMLStreamReader getXMLStreamReader(IContainer container, boolean cache, OMXMLStreamReaderConfiguration configuration) {
        OMXMLParserWrapper builder = container.getBuilder();
        if (builder != null && builder instanceof StAXOMBuilder) {
            if (!container.isComplete()) {
                if (((StAXOMBuilder) builder).isLookahead()) {
                    buildNext(container);
                }
            }
        }
       
        // The om tree was built by hand and is already complete
        OMXMLStreamReader reader;
        boolean done = container.isComplete();
        if ((builder == null) && done) {
            reader = new OMStAXWrapper(null, container, false, configuration.isPreserveNamespaceContext());
        } else {
            if ((builder == null) && !cache) {
                throw new UnsupportedOperationException(
                "This element was not created in a manner to be switched");
            }
            if (builder != null && builder.isCompleted() && !cache && !done) {
                throw new UnsupportedOperationException(
                "The parser is already consumed!");
            }
            reader = new OMStAXWrapper(builder, container, cache, configuration.isPreserveNamespaceContext());
        }
View Full Code Here

            container.setComplete(false);
        }
    }
   
    public static void build(IContainer container) {
        OMXMLParserWrapper builder = container.getBuilder();
        if (builder != null && builder.isCompleted()) {
            log.debug("Builder is already complete.");
        }
        while (!container.isComplete()) {

            builder.next();   
            if (builder.isCompleted() && !container.isComplete()) {
                log.debug("Builder is complete.  Setting OMObject to complete.");
                container.setComplete(true);
            }
        }
    }
View Full Code Here

            }
        }
    }
   
    public static void buildNext(IParentNode that) {
        OMXMLParserWrapper builder = that.getBuilder();
        if (builder != null) {
            if (((StAXOMBuilder)builder).isClosed()) {
                throw new OMException("The builder has already been closed");
            } else if (!builder.isCompleted()) {
                builder.next();
            } else {
                // If the builder is suddenly complete, but the completion status of the node
                // doesn't change, then this means that we built the wrong nodes
                throw new IllegalStateException("Builder is already complete");
            }        
View Full Code Here

        assertTrue(outputString != null && !"".equals(outputString) && outputString.length() > 1);

    }

    public void testElementPullStream1() throws Exception {
        OMXMLParserWrapper builder = OMXMLBuilderFactory.createSOAPModelBuilder(
                getTestResource(TestConstants.SOAP_SOAPMESSAGE), null);
        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
        StreamingOMSerializer serializer = new StreamingOMSerializer();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream);

        serializer.serialize(env.getXMLStreamReaderWithoutCaching(), writer);
View Full Code Here

    private SOAPEnvelope envelope = null;
    private File tempFile;
    private XMLStreamReader parser;

    protected void setUp() throws Exception {
        OMXMLParserWrapper builder = OMXMLBuilderFactory.createSOAPModelBuilder(
                getTestResource(TestConstants.SOAP_SOAPMESSAGE1), null);
        envelope = (SOAPEnvelope) builder.getDocumentElement();
        tempFile = File.createTempFile("temp", "xml");

    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMXMLParserWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.