use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestGetDefaultEnvelope method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope env = soapFactory.getDefaultEnvelope();
// Check correct SOAP version
assertEquals(spec.getEnvelopeNamespaceURI(), env.getNamespaceURI());
// getDefaultEnvelope doesn't create a SOAPMessage/OMDocument
assertNull(env.getParent());
// Check the children
Iterator<OMNode> it = env.getChildren();
assertTrue(it.hasNext());
OMNode child = it.next();
assertTrue(child instanceof SOAPHeader);
assertNull(((SOAPHeader) child).getFirstOMChild());
child = it.next();
assertTrue(child instanceof SOAPBody);
assertNull(((SOAPBody) child).getFirstOMChild());
assertFalse(it.hasNext());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestGetValueAsQName method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope env = soapFactory.getDefaultEnvelope();
SOAPFault fault = soapFactory.createSOAPFault(env.getBody());
SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault);
QName value = new QName("urn:test", "myFaultCode");
code.setValue(value);
assertEquals(value, code.getValueAsQName());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestAddHeaderBlock method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope soapEnvelope = soapFactory.createSOAPEnvelope();
SOAPHeader soapHeader = soapFactory.createSOAPHeader(soapEnvelope);
OMNamespace namespace = soapFactory.createOMNamespace("http://www.example.org", "test");
SOAPHeaderBlock headerBlock1 = soapHeader.addHeaderBlock("echoOk1", namespace);
SOAPHeaderBlock headerBlock2 = soapHeader.addHeaderBlock("echoOk2", namespace);
Iterator<OMNode> iterator = soapHeader.getChildren();
assertSame(headerBlock1, iterator.next());
assertSame(soapHeader, headerBlock1.getParent());
assertNotNull("SOAP Header Test : - After calling addHeaderBlock method twice, getChildren method returns empty iterator", headerBlock1);
assertEquals("SOAP Header Test : - HeaderBlock1 local name mismatch", "echoOk1", headerBlock1.getLocalName());
assertEquals("SOAP Header Test : - HeaderBlock1 namespace uri mismatch", "http://www.example.org", headerBlock1.getNamespace().getNamespaceURI());
assertSame(headerBlock2, iterator.next());
assertSame(soapHeader, headerBlock2.getParent());
assertNotNull("SOAP Header Test : - After calling addHeaderBlock method twice, getChildren method returns an iterator with only one object", headerBlock2);
assertEquals("SOAP Header Test : - HeaderBlock2 local name mismatch", "echoOk2", headerBlock2.getLocalName());
assertEquals("SOAP Header Test : - HeaderBlock2 namespace uri mismatch", "http://www.example.org", headerBlock2.getNamespace().getNamespaceURI());
assertFalse("SOAP Header Test : - After calling addHeaderBlock method twice, getChildren method returns an iterator with more than two elements", iterator.hasNext());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestAddHeaderBlockFromQName method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope env = soapFactory.getDefaultEnvelope();
SOAPHeader header = env.getOrCreateHeader();
SOAPHeaderBlock headerBlock = header.addHeaderBlock(new QName("urn:test", "test", "p"));
assertSame(headerBlock, header.getFirstOMChild());
assertEquals("test", headerBlock.getLocalName());
assertEquals("p", headerBlock.getPrefix());
assertEquals("urn:test", headerBlock.getNamespaceURI());
}
use of org.apache.axiom.soap.SOAPEnvelope in project webservices-axiom by apache.
the class TestAddHeaderBlockFromQNameWithoutNamespace method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPHeader header = soapFactory.createSOAPHeader(envelope);
try {
header.addHeaderBlock(new QName("test"));
fail("Expected OMException");
} catch (OMException ex) {
// Expected
}
}
Aggregations