use of org.apache.axiom.soap.SOAPBody in project webservices-axiom by apache.
the class TestCreateDefaultSOAPMessage method runTest.
@Override
protected void runTest() throws Throwable {
SOAPMessage message = soapFactory.createDefaultSOAPMessage();
SOAPEnvelope env = message.getSOAPEnvelope();
assertNotNull(env);
assertSame(env, message.getFirstOMChild());
assertNull(env.getNextOMSibling());
// Check correct SOAP version
assertEquals(spec.getEnvelopeNamespaceURI(), env.getNamespaceURI());
// Check the children
Iterator<OMNode> it = env.getChildren();
assertTrue(it.hasNext());
OMNode child = it.next();
assertTrue(child instanceof SOAPBody);
assertNull(((SOAPBody) child).getFirstOMChild());
assertFalse(it.hasNext());
}
use of org.apache.axiom.soap.SOAPBody in project webservices-axiom by apache.
the class TestCreateSOAPFaultWithException method runTest.
@Override
protected void runTest() throws Throwable {
SOAPBody body = withParent ? soapFactory.getDefaultEnvelope().getBody() : null;
SOAPFault fault = soapFactory.createSOAPFault(body, new Exception("Testing soap fault"));
if (body != null) {
assertThat(body.hasFault()).isTrue();
assertThat(body.getFault()).isSameAs(fault);
}
assertThat(fault.isComplete()).isTrue();
SOAPFaultDetail detail = fault.getDetail();
assertThat(detail).isNotNull();
Iterator<OMElement> it = detail.getAllDetailEntries();
assertThat(it.hasNext()).isTrue();
OMElement entry = it.next();
assertThat(entry.getQName()).isEqualTo(new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
assertThat(entry.getText()).contains("Testing soap fault");
}
use of org.apache.axiom.soap.SOAPBody 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.SOAPBody in project webservices-axiom by apache.
the class TestDiscardPartiallyBuilt method runTest.
@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
SOAPHeader header = envelope.getHeader();
OMElement from = header.getFirstChildWithName(new QName("http://www.w3.org/2005/08/addressing", "ReplyTo"));
from.getFirstElement().getFirstOMChild();
// Just in case getFirstChildWithName or getFirstElement did stupid things
assertFalse(from.isComplete());
header.discard();
OMElement body = envelope.getFirstElement();
assertTrue(body instanceof SOAPBody);
}
use of org.apache.axiom.soap.SOAPBody in project webservices-axiom by apache.
the class TestCloneWithSourcedElement1 method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope sourceEnv = soapFactory.getDefaultEnvelope();
SOAPBody body = sourceEnv.getBody();
// Create a payload
OMDataSource bads = new StringOMDataSource("<tns:payload xmlns:tns=\"urn://test\">Hello World</tns:payload>");
OMNamespace ns = body.getOMFactory().createOMNamespace("urn://test", "tns");
OMSourcedElement omse = body.getOMFactory().createOMElement(bads, "payload", ns);
body.addChild(omse);
copyAndCheck(sourceEnv);
assertFalse(omse.isExpanded());
}
Aggregations