use of org.apache.axiom.soap.SOAPHeader in project webservices-axiom by apache.
the class TestGetBooleanAttributeInvalid method runTest.
@Override
protected void runTest() throws Throwable {
SOAPHeader header = soapFactory.getDefaultEnvelope().getOrCreateHeader();
SOAPHeaderBlock headerBlock = header.addHeaderBlock(new QName("urn:test", "test", "p"));
headerBlock.addAttribute(attribute.getName(spec), value, header.getNamespace());
try {
attribute.getAdapter(BooleanAttributeAccessor.class).getValue(headerBlock);
fail("Expected SOAPProcessingException");
} catch (SOAPProcessingException ex) {
// Expected
}
}
use of org.apache.axiom.soap.SOAPHeader 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.SOAPHeader 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.SOAPHeader 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
}
}
use of org.apache.axiom.soap.SOAPHeader in project webservices-axiom by apache.
the class TestSetBooleanAttributeUnsupported 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).setValue(headerBlock, true);
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException ex) {
// Expected
}
}
Aggregations