Examples of SOAPHeaderBlock


Examples of org.apache.axiom.soap.SOAPHeaderBlock

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

    protected void runTest() throws Throwable {
        SOAPHeaderBlock soapHeaderBlock = createSOAPHeaderBlock();
        assertFalse(
                "SOAP HeaderBlock Test : - After creating SOAPHeaderBlock, default MustUnderstand value true",
                soapHeaderBlock.getMustUnderstand());
        soapHeaderBlock.setMustUnderstand(true);
        assertTrue(
                "SOAP HeaderBlock Test : - After setting MustUnderstand true calling setMustUnderstand method , getMustUnderstand method returns false",
                soapHeaderBlock.getMustUnderstand());
    }
View Full Code Here

Examples of org.apache.axiom.soap.SOAPHeaderBlock

    }

    protected void runTest() throws Throwable {
        OMElement parent = soapFactory.createOMElement("parent", null);
        OMElement child1 = soapFactory.createOMElement("child1", null, parent);
        SOAPHeaderBlock hb = soapFactory.createSOAPHeaderBlock("MyHeader", soapFactory.createOMNamespace("urn:test", "p"));
        try {
            child1.insertSiblingAfter(hb);
            fail("Expected SOAPProcessingException");
        } catch (SOAPProcessingException ex) {
            // Expected
View Full Code Here

Examples of org.apache.axiom.soap.SOAPHeaderBlock

        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        OMElement parent = soapFactory.createOMElement("parent", null);
        SOAPHeaderBlock hb = soapFactory.createSOAPHeaderBlock("MyHeader", soapFactory.createOMNamespace("urn:test", "p"));
        try {
            parent.addChild(hb);
            fail("Expected SOAPProcessingException");
        } catch (SOAPProcessingException ex) {
            // Expected
View Full Code Here

Examples of org.apache.axiom.soap.SOAPHeaderBlock

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

    protected void runTest() throws Throwable {
        SOAPHeaderBlock h = soapFactory.createSOAPHeaderBlock("myHeader", soapFactory.createOMNamespace("urn:test", "p"));
        assertSame(spec.getVersion(), h.getVersion());
    }
View Full Code Here

Examples of org.apache.axiom.soap.SOAPHeaderBlock

       
        OMSourcedElement omse = soapFactory.createSOAPHeaderBlock(localName, ns, bads1);
        soapHeader.addChild(omse);
        OMNode firstChild = soapHeader.getFirstOMChild();
        assertTrue("Expected OMSourcedElement child", firstChild instanceof SOAPHeaderBlock);
        SOAPHeaderBlock child = (SOAPHeaderBlock) firstChild;
        assertTrue("OMSourcedElement is expanded.  This is unexpected", !child.isExpanded());
        assertTrue("OMSourcedElement should be backed by a ByteArrayDataSource",
                   child.getDataSource() instanceof ByteArrayDataSource);
       
        // Make sure that getting the MustUnderstand property does not cause expansion.
        assertTrue(!child.getMustUnderstand());
        assertTrue("OMSourcedElement is expanded.  This is unexpected", !child.isExpanded());
        assertTrue("OMSourcedElement should be backed by a ByteArrayDataSource",
                   child.getDataSource() instanceof ByteArrayDataSource);
       
        // A ByteArrayDataSource does not consume the backing object when read.
        // Thus getting the XMLStreamReader of the ByteArrayDataSource should not
        // cause expansion of the OMSourcedElement.
        XMLStreamReader reader = child.getXMLStreamReader();
        reader.next();
        assertTrue("OMSourcedElement is expanded.  This is unexpected", !child.isExpanded());
       
        // Likewise, a ByteArrayDataSource does not consume the backing object when
        // written.  Thus serializing the OMSourcedElement should not cause the expansion
        // of the OMSourcedElement.
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        soapHeader.serialize(baos);
        String output = baos.toString(encoding);
//        System.out.println(output);
        assertTrue("The payload was not present in the output",
                   output.indexOf(payload1) > 0);
        assertTrue("OMSourcedElement is expanded.  This is unexpected", !child.isExpanded());
       
        // Test getting the raw bytes from the ByteArrayDataSource.
        OMDataSourceExt ds = (OMDataSourceExt) child.getDataSource();
        byte[] bytes = ds.getXMLBytes("UTF-16")// Get the bytes as UTF-16
        String payload = new String(bytes, "utf-16");
        assertTrue("The obtained bytes did not match the payload",
                   payload1.equals(payload));
    }
View Full Code Here

Examples of org.apache.axiom.soap.SOAPHeaderBlock

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

    protected void runTest() throws Throwable {
        SOAPHeaderBlock soapHeaderBlock = createSOAPHeaderBlock();
        soapHeaderBlock.setRole(
                "http://example.org/my-role");
        assertEquals(
                "SOAP HeaderBlock Test : - After calling setRole method, getRole method returns incorrect role value",
                "http://example.org/my-role", soapHeaderBlock.getRole());
        try {
            soapHeaderBlock.setRole("Any Value");
        } catch (Exception e) {
            fail(
                    "SOAP HeaderBlock Test : - role value can not be set to any value");
        }
    }
View Full Code Here

Examples of org.apache.axiom.soap.SOAPHeaderBlock

        this.value = value;
        this.stringValue = stringValue;
    }

    protected void runTest() throws Throwable {
        SOAPHeaderBlock soapHeaderBlock = createSOAPHeaderBlock();
        soapHeaderBlock.setMustUnderstand(value);
        assertEquals("getMustUnderstand return value", value, soapHeaderBlock.getMustUnderstand());
        Iterator it = soapHeaderBlock.getAllAttributes();
        assertTrue(it.hasNext());
        OMAttribute att = (OMAttribute)it.next();
        OMNamespace ns = att.getNamespace();
        assertEquals(spec.getEnvelopeNamespaceURI(), ns.getNamespaceURI());
        assertEquals(SOAPConstants.ATTR_MUSTUNDERSTAND, att.getLocalName());
View Full Code Here

Examples of org.apache.axiom.soap.SOAPHeaderBlock

    }

    protected void runTest() throws Throwable {
        OMElement parent = soapFactory.createOMElement("parent", null);
        OMElement child1 = soapFactory.createOMElement("child1", null, parent);
        SOAPHeaderBlock hb = soapFactory.createSOAPHeaderBlock("MyHeader", soapFactory.createOMNamespace("urn:test", "p"));
        try {
            child1.insertSiblingBefore(hb);
            fail("Expected SOAPProcessingException");
        } catch (SOAPProcessingException ex) {
            // Expected
View Full Code Here

Examples of org.apache.axiom.soap.SOAPHeaderBlock

    public void testCreateSOAPHeaderBlock() throws Exception {
        OMXMLParserWrapper omBuilder = OMXMLBuilderFactory.createSOAPModelBuilder(
                getTestResource(TestConstants.SOAP_SOAPMESSAGE), null);
        SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
        SOAPHeader soapHeader = soapEnvelope.getHeader();
        SOAPHeaderBlock soapHeaderBlock = omFactory.createSOAPHeaderBlock(
                "soapHeaderBlockOne", namespace, soapHeader);
        assertTrue(
                "Programatically created SOAPHeaderBlock should have done = true ",
                soapHeaderBlock.isComplete());
    }
View Full Code Here

Examples of org.apache.axiom.soap.SOAPHeaderBlock

        SOAPHeader header = soapFactory.createSOAPHeader(envelope);
        OMNamespace ns1 = soapFactory.createOMNamespace("urn:ns1", "ns1");
        OMNamespace ns2 = soapFactory.createOMNamespace("urn:ns2", "ns2");
        String myRole = "urn:myRole";
        String otherRole ="urn:otherRole";
        SOAPHeaderBlock headerBlock1 = header.addHeaderBlock("header1", ns1);
        headerBlock1.setRole(myRole);
        SOAPHeaderBlock headerBlock2 = header.addHeaderBlock("header2", ns2);
        headerBlock2.setRole(myRole);
        SOAPHeaderBlock headerBlock3 = header.addHeaderBlock("header3", ns1);
        headerBlock3.setRole(myRole);
        SOAPHeaderBlock headerBlock4 = header.addHeaderBlock("header4", ns1);
        headerBlock4.setRole(otherRole);
        Iterator it = header.getHeadersToProcess(new MyRolePlayer(false, new String[] { myRole }), ns1.getNamespaceURI());
        assertTrue(it.hasNext());
        assertSame(headerBlock1, it.next());
        assertTrue(it.hasNext());
        assertSame(headerBlock3, it.next());
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.