Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPEnvelope


    public TestDetach(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = getTestMessage(MESSAGE);
        OMDocument document = (OMDocument)envelope.getParent();
        envelope.detach();
        assertNull(envelope.getParent());
        assertNull(envelope.getPreviousOMSibling());
        assertNull(envelope.getNextOMSibling());
        assertNull(document.getOMDocumentElement());
    }
View Full Code Here


    // START SNIPPET: dom
    public void validateUsingDOM(InputStream in, URL schemaUrl) throws Exception {
        OMMetaFactory mf = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM);
        SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(mf, in, "UTF-8");
        SOAPEnvelope envelope = builder.getSOAPEnvelope();
        OMElement bodyContent = envelope.getBody().getFirstElement();
        SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = schemaFactory.newSchema(schemaUrl);
        Validator validator = schema.newValidator();
        validator.validate(new DOMSource((Element)bodyContent));
    }
View Full Code Here

    public TestGetBody(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
        SOAPBody body = envelope.getBody();
        assertEquals("Body Test : - Body local name mismatch",
                SOAPConstants.BODY_LOCAL_NAME, body.getLocalName());
        assertEquals("Body Test : - Body namespace mismatch",
                spec.getEnvelopeNamespaceURI(), body.getNamespace().getNamespaceURI());
    }
View Full Code Here

    public TestGetXMLStreamReaderWithoutCachingWithPartiallyBuiltHeaderBlock(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = getTestMessage(SOAP_MESSAGE);
        SOAPHeaderBlock headerBlock = (SOAPHeaderBlock)envelope.getHeader().getFirstChildWithName(
                new QName("http://schemas.xmlsoap.org/ws/2004/03/addressing", "From"));
        headerBlock.getFirstElement().getFirstOMChild();
        assertFalse(headerBlock.isComplete());
        XMLStreamReader reader = envelope.getXMLStreamReaderWithoutCaching();
        while (reader.hasNext()) {
            reader.next();
        }
        assertFalse(headerBlock.isComplete());
    }
View Full Code Here

        addTestProperty("prefix", qname.getPrefix());
        addTestProperty("uri", qname.getNamespaceURI());
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
        OMElement bodyElement = soapFactory.createOMElement(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix());
        envelope.getBody().addChild(bodyElement);
        assertEquals(qname.getLocalPart(), envelope.getSOAPBodyFirstElementLocalName());
        OMNamespace ns = envelope.getSOAPBodyFirstElementNS();
        if (qname.getNamespaceURI().length() == 0) {
            assertNull(ns);
        } else {
            assertEquals(qname.getNamespaceURI(), ns.getNamespaceURI());
            assertEquals(qname.getPrefix(), ns.getPrefix());
View Full Code Here

    public TestGetBodyOnEnvelopeWithHeaderOnly(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
        soapFactory.createSOAPHeader(envelope);
        assertNull(envelope.getBody());
    }
View Full Code Here

    public TestGetHeaderWithParser(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = getTestMessage(MESSAGE);
        SOAPHeader header = envelope.getHeader();
        assertEquals("Header Test : - Header local name mismatch",
                SOAPConstants.HEADER_LOCAL_NAME, header.getLocalName());
        assertEquals("Header Test : - Header namespace mismatch",
                spec.getEnvelopeNamespaceURI(), header.getNamespace().getNamespaceURI());
    }
View Full Code Here

    public TestGetHeader(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
        SOAPHeader header = envelope.getHeader();
        assertEquals("Header Test : - Header local name mismatch",
                SOAPConstants.HEADER_LOCAL_NAME, header.getLocalName());
        assertEquals("Header Test : - Header namespace mismatch",
                spec.getEnvelopeNamespaceURI(), header.getNamespace().getNamespaceURI());
    }
View Full Code Here

    public TestAddHeaderToIncompleteEnvelope(OMMetaFactory metaFactory, SOAPSpec spec) {
        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = getTestMessage(MESSAGE_WITHOUT_HEADER);
        assertNull(envelope.getHeader());
        SOAPHeader header = soapFactory.createSOAPHeader(envelope);
        assertSame(header, envelope.getHeader());
    }
View Full Code Here

        XMLStreamReader soap11Parser = StAXUtils.createXMLStreamReader(
                AbstractTestCase.getTestResource("soap/" + spec.getName() + "/" + MESSAGE), null);
        QName qname = new QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.BODY_FAULT_LOCAL_NAME, "SOAP-ENV");
        XMLStreamReaderWithQName parser = new XMLStreamReaderWithQName(soap11Parser, qname);
        SOAPModelBuilder soap11Builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(metaFactory, parser);
        SOAPEnvelope env = soap11Builder.getSOAPEnvelope();
        assertTrue(env.hasFault());
        assertTrue(!parser.isReadBody());
       
        // Get the name of the first element in the body
        String localName = env.getSOAPBodyFirstElementLocalName();
        assertTrue(localName.equals("Fault"));
        assertTrue(!parser.isReadBody());
        parser.close();
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.soap.SOAPEnvelope

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.