Search in sources :

Example 36 with SOAPHeader

use of org.apache.axiom.soap.SOAPHeader in project webservices-axiom by apache.

the class TestGetOrCreateHeader method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
    SOAPHeader header = (SOAPHeader) envelope.getFirstOMChild();
    assertSame(header, envelope.getOrCreateHeader());
}
Also used : SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope) SOAPHeader(org.apache.axiom.soap.SOAPHeader)

Example 37 with SOAPHeader

use of org.apache.axiom.soap.SOAPHeader in project webservices-axiom by apache.

the class TestAddHeaderBlockWithoutNamespace1 method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
    SOAPHeader header = soapFactory.createSOAPHeader(envelope);
    try {
        header.addHeaderBlock("test", null);
        fail("Expected OMException");
    } catch (OMException ex) {
    // Expected
    }
}
Also used : SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope) OMException(org.apache.axiom.om.OMException) SOAPHeader(org.apache.axiom.soap.SOAPHeader)

Example 38 with SOAPHeader

use of org.apache.axiom.soap.SOAPHeader in project webservices-axiom by apache.

the class TestAddHeaderToIncompleteEnvelope method runTest.

@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
    assertNull(envelope.getHeader());
    SOAPHeader header = soapFactory.createSOAPHeader(envelope);
    assertSame(header, envelope.getHeader());
}
Also used : SOAPHeader(org.apache.axiom.soap.SOAPHeader)

Example 39 with SOAPHeader

use of org.apache.axiom.soap.SOAPHeader in project webservices-axiom by apache.

the class TestGetBooleanAttributeUnspported method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPHeader header = soapFactory.getDefaultEnvelope().getOrCreateHeader();
    SOAPHeaderBlock headerBlock = header.addHeaderBlock(new QName("urn:test", "test", "p"));
    try {
        attribute.getAdapter(BooleanAttributeAccessor.class).getValue(headerBlock);
        fail("Expected UnsupportedOperationException");
    } catch (UnsupportedOperationException ex) {
    // Expected
    }
}
Also used : QName(javax.xml.namespace.QName) BooleanAttributeAccessor(org.apache.axiom.ts.soap.BooleanAttributeAccessor) SOAPHeaderBlock(org.apache.axiom.soap.SOAPHeaderBlock) SOAPHeader(org.apache.axiom.soap.SOAPHeader)

Example 40 with SOAPHeader

use of org.apache.axiom.soap.SOAPHeader in project webservices-axiom by apache.

the class TestAddHeaderBlockWithoutNamespace2 method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
    SOAPHeader header = soapFactory.createSOAPHeader(envelope);
    OMNamespace ns = soapFactory.createOMNamespace("", "");
    try {
        header.addHeaderBlock("test", ns);
        fail("Expected OMException");
    } catch (OMException ex) {
    // Expected
    }
}
Also used : OMNamespace(org.apache.axiom.om.OMNamespace) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope) OMException(org.apache.axiom.om.OMException) SOAPHeader(org.apache.axiom.soap.SOAPHeader)

Aggregations

SOAPHeader (org.apache.axiom.soap.SOAPHeader)56 SOAPHeaderBlock (org.apache.axiom.soap.SOAPHeaderBlock)33 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)32 OMElement (org.apache.axiom.om.OMElement)18 OMNamespace (org.apache.axiom.om.OMNamespace)15 QName (javax.xml.namespace.QName)13 Iterator (java.util.Iterator)10 OMNode (org.apache.axiom.om.OMNode)10 SOAPFactory (org.apache.axiom.soap.SOAPFactory)9 SOAPBody (org.apache.axiom.soap.SOAPBody)8 SOAPFault (org.apache.axiom.soap.SOAPFault)5 OMException (org.apache.axiom.om.OMException)4 EndpointReference (org.apache.axis2.addressing.EndpointReference)4 OMAttribute (org.apache.axiom.om.OMAttribute)3 SOAPFaultCode (org.apache.axiom.soap.SOAPFaultCode)3 SOAPFaultDetail (org.apache.axiom.soap.SOAPFaultDetail)3 SOAPFaultReason (org.apache.axiom.soap.SOAPFaultReason)3 BooleanAttributeAccessor (org.apache.axiom.ts.soap.BooleanAttributeAccessor)3 Element (org.w3c.dom.Element)3 StringReader (java.io.StringReader)2