Examples of OMXMLParserWrapper


Examples of org.apache.axiom.om.OMXMLParserWrapper

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

    public void testElementPullStream1WithCacheOff() throws Exception {

        OMXMLParserWrapper builder = OMXMLBuilderFactory.createSOAPModelBuilder(
                getTestResource(TestConstants.SOAP_SOAPMESSAGE), null);
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream,
                OMConstants.DEFAULT_CHAR_SET_ENCODING);

        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
        env.serializeAndConsume(writer);
        writer.flush();

        String outputString = new String(byteArrayOutputStream.toByteArray());
        assertTrue(outputString != null && !"".equals(outputString) && outputString.length() > 1);
View Full Code Here

Examples of org.apache.axiom.om.OMXMLParserWrapper

            fail("Expecting an XMLStreamException, but got instead: " + e.getClass().getName() + ": " + e.getMessage());
        }
    }

    public void testElementPullStream2() throws Exception {
        OMXMLParserWrapper builder = OMXMLBuilderFactory.createSOAPModelBuilder(
                getTestResource(TestConstants.SOAP_SOAPMESSAGE), null);
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream);

        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
        SOAPBody body = env.getBody();
        StreamingOMSerializer serializer = new StreamingOMSerializer();
        serializer.serialize(body.getXMLStreamReaderWithoutCaching(),
                             writer);
        writer.flush();
View Full Code Here

Examples of org.apache.axiom.om.OMXMLParserWrapper

        final String USR_DEF = "xmlns:usr";
       
        XMLStreamReader reader =
            XMLInputFactory.newInstance()
                           .createXMLStreamReader(getTestResource("soap/soapmessageWithXSI.xml"));
        OMXMLParserWrapper builder =
            OMXMLBuilderFactory.createStAXSOAPModelBuilder(reader);
       
        // Get the envelope and then get the body
        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
        SOAPBody body = env.getBody();
       
        StreamingOMSerializer serializer = new StreamingOMSerializer();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream);
View Full Code Here

Examples of org.apache.axiom.om.OMXMLParserWrapper

        final String USR_DEF = "xmlns:usr";
       
        XMLStreamReader reader =
            XMLInputFactory.newInstance()
                           .createXMLStreamReader(getTestResource("soap/soapmessageWithXSI.xml"));
        OMXMLParserWrapper builder =
            OMXMLBuilderFactory.createStAXSOAPModelBuilder(reader);
       
        // Get and build the whole tree...this will cause no streaming when doing the write
        SOAPEnvelope env = (SOAPEnvelope) builder.getDocumentElement();
        env.build();
       
        // Get the body
        SOAPBody body = env.getBody();
       
View Full Code Here

Examples of org.apache.axiom.om.OMXMLParserWrapper

        doomEnv.build();

        OMElement payload = doomEnv.getBody().getFirstElement();

        OMXMLParserWrapper llomBuilder =
                OMXMLBuilderFactory.createStAXOMBuilder(payload.getXMLStreamReaderWithoutCaching());

        OMElement llomPayload = llomBuilder.getDocumentElement();

        llomPayload.build();

        String xml = llomPayload.toString();
View Full Code Here

Examples of org.apache.axiom.om.OMXMLParserWrapper

                    "</ds:X509Data>\n" +
                    "</ds:KeyInfo></ds:Signature></Assertion>";


    public void testOMNS() {
        OMXMLParserWrapper builder =
                OMXMLBuilderFactory.createOMBuilder(new StringReader(originalXML));
        OMElement documentElement = builder.getDocumentElement();
        //assertXMLEqual(originalXML, documentElement.toString());
        documentElement.build();

        String outstr = documentElement.toString();
        assertTrue(outstr.indexOf("xmlns:saml=") > 0);
View Full Code Here

Examples of org.apache.axiom.om.OMXMLParserWrapper

        assertEquals(at.getAttributeType(), "CDATA");
    }

    private String addAttributeMethod1(String xmlString) throws Exception {
        OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createOMBuilder(new StringReader(xmlString));
        OMElement doc = builder2.getDocumentElement();

        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace("http://www.me.com", "axiom");

        //code line to be tested
View Full Code Here

Examples of org.apache.axiom.om.OMXMLParserWrapper

        return doc.toString();
    }

    private String addAttributeMethod2(String xmlString) throws Exception {
        OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createOMBuilder(new StringReader(xmlString));
        OMElement doc = builder2.getDocumentElement();

        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace("http://www.me.com", "axiom");

        //code line to be tested
View Full Code Here

Examples of org.apache.axiom.om.OMXMLParserWrapper

                omElement.isComplete());

    }

    public void testCreateOMElement() throws Exception {
        OMXMLParserWrapper omBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(
                getTestResource(TestConstants.WHITESPACE_MESSAGE), null);
        OMElement envelope = omBuilder.getDocumentElement();
       
        // The body is the second element
        OMNode node = envelope.getFirstElement();
        node = node.getNextOMSibling();
        while (node != null && !(node instanceof OMElement)) {
View Full Code Here

Examples of org.apache.axiom.om.OMXMLParserWrapper

                     element.getNamespace(),
                     namespace);
    }

    public void testCreateSOAPBody() throws Exception {
        OMXMLParserWrapper omBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(
                getTestResource(TestConstants.MINIMAL_MESSAGE), null);
        SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
        SOAPBody soapBodyOne = omFactory.createSOAPBody(soapEnvelope);
        assertTrue(
                "Programatically created SOAPBody should have done = true ",
                soapBodyOne.isComplete());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.