Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPBody


        addTestProperty("uri", qname.getNamespaceURI());
        addTestProperty("localName", qname.getLocalPart());
    }

    protected void runTest() throws Throwable {
        SOAPBody body = soapFactory.getDefaultEnvelope().getBody();
        body.addChild(soapFactory.createOMElement(
                qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix()));
        assertNull(body.getFault());
    }
View Full Code Here


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

    protected void runTest() throws Throwable {
        SOAPBody body = getTestMessage(MESSAGE).getBody();
        assertNotNull(
                "Body Test With parser :- getFault method returns null",
                body.getFault());
        assertEquals(
                "Body Test With parser : - SOAP fault name mismatch",
                SOAPConstants.SOAPFAULT_LOCAL_NAME, body.getFault().getLocalName());
    }
View Full Code Here

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

    protected void runTest() throws Throwable {
        SOAPBody body = soapFactory.getDefaultEnvelope().getBody();
        soapFactory.createOMElement("Fault", soapFactory.getNamespace(), body);
        assertFalse(body.hasFault());
    }
View Full Code Here

        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
        SOAPBody body = soapFactory.createSOAPBody(envelope);
        body.addFault(new Exception("This an exception for testing"));
        assertTrue(
                "Body Test:- After calling addFault method, SOAP body has no fault",
                body.hasFault());
    }
View Full Code Here

        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
        SOAPBody body = soapFactory.createSOAPBody(envelope);
        SOAPFault fault = soapFactory.createSOAPFault(body);
        SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail(fault);
        OMNamespace omNamespace = soapFactory.createOMNamespace("http://www.test.org", "test");
        Iterator iterator = soapFaultDetail.getAllDetailEntries();
        assertFalse(
View Full Code Here

        // Ignore the serialization comparison
        copyAndCheck(createEnvelope(getTestResource(TestConstants.REALLY_BIG_MESSAGE)), false);
    }
    public void testOMSE() throws Exception {
        SOAPEnvelope sourceEnv = createEnvelope(getTestResource(TestConstants.EMPTY_BODY_MESSAGE));
        SOAPBody body = sourceEnv.getBody();
       
        // Create a payload
        String text = "<tns:payload xmlns:tns=\"urn://test\">Hello World</tns:payload>";
        String encoding = "UTF-8";
        ByteArrayDataSource bads = new ByteArrayDataSource(text.getBytes(encoding), encoding);
        OMNamespace ns = body.getOMFactory().createOMNamespace("urn://test", "tns");
        OMSourcedElement omse =body.getOMFactory().createOMElement(bads, "payload", ns);
        body.addChild(omse);
        copyAndCheck(sourceEnv, true);
    }
View Full Code Here

        copyAndCheck(sourceEnv, true);
    }
   
    public void testOMSE2() throws Exception {
        SOAPEnvelope sourceEnv = createEnvelope(getTestResource(TestConstants.EMPTY_BODY_MESSAGE));
        SOAPBody body = sourceEnv.getBody();
        SOAPHeader header = sourceEnv.getHeader();
        String encoding = "UTF-8";
       
        // Create a header OMSE
        String hdrText = "<hdr:myheader xmlns:hdr=\"urn://test\">Hello World</hdr:myheader>";
        ByteArrayDataSource badsHdr =
            new ByteArrayDataSource(hdrText.getBytes(encoding), encoding);
        OMNamespace hdrNS = header.getOMFactory().createOMNamespace("urn://test", "hdr");
        SOAPFactory sf = (SOAPFactory) header.getOMFactory();
        SOAPHeaderBlock shb = sf.createSOAPHeaderBlock("myheader", hdrNS, badsHdr);
        shb.setProcessed()// test setting processing flag
        header.addChild(shb);
       
        // Create a payload
        String text = "<tns:payload xmlns:tns=\"urn://test\">Hello World</tns:payload>";
        ByteArrayDataSource bads = new ByteArrayDataSource(text.getBytes(encoding), encoding);
        OMNamespace ns = body.getOMFactory().createOMNamespace("urn://test", "tns");
        OMSourcedElement omse =body.getOMFactory().createOMElement(bads, "payload", ns);
        body.addChild(omse);
       
        copyAndCheck(sourceEnv, true);
       
        // The source SOAPHeaderBlock should not be expanded in the process
        assertTrue(shb.isExpanded() == false);
View Full Code Here

        if (checkText) {
            assertTrue("\nSource=" + sourceText +
                   "\nTarget=" + targetText,
                   sourceText.equals(targetText));
        }
        SOAPBody body = sourceEnv.getBody();
        OMElement payload = body.getFirstElement();
       
        assertTrue("Expected OMSourcedElement payload", payload instanceof OMSourcedElement);
        assertTrue("Expected unexpanded payload", !((OMSourcedElement)payload).isExpanded());
       
    }
View Full Code Here

        // Advance past the header
        root.getOrCreateHeader();

        // Now advance the parser to the body element
        SOAPBody body = root.getBody();
        if (body == null) {
            // Create the body if one does not exist
            body = soapFactory.createSOAPBody(root);
        }
    }
View Full Code Here

    }

    public void setXMLFault(XMLFault xmlFault) throws WebServiceException {

        // Clear out the existing body and detail blocks
        SOAPBody body = root.getBody();
        getNumDetailBlocks(); // Forces parse of existing detail blocks
        getNumBodyBlocks()// Forces parse over body
        OMNode child = body.getFirstOMChild();
        while (child != null) {
            child.detach();
            child = body.getFirstOMChild();
        }

        // Add a SOAPFault to the body.
        SOAPFault soapFault = XMLFaultUtils.createSOAPFault(xmlFault, body, false);
    }
View Full Code Here

TOP

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

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.