use of org.apache.axiom.soap.SOAPBody in project webservices-axiom by apache.
the class TestSerializeAndConsumeWithOMSEInBody method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPBody body = soapFactory.createSOAPBody();
envelope.addChild(body);
OMNamespace ns = soapFactory.createOMNamespace("http://ns1", "d");
OMElement payload = soapFactory.createOMElement(new DummySource(), "dummy", ns);
// This line will cause NoSuchElementException
payload.setNamespace(ns);
body.addChild(payload);
StringWriter writer = new StringWriter();
envelope.serializeAndConsume(writer);
// System.out.println(writer);
}
use of org.apache.axiom.soap.SOAPBody in project webservices-axiom by apache.
the class TestHasFaultWithOMSEUnknownName method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
SOAPBody body = envelope.getBody();
OMSourcedElement element = soapFactory.createOMElement(new StringOMDataSource("<ns:root xmlns:ns='urn:ns'/>"));
body.addChild(element);
assertFalse(body.hasFault());
assertFalse(element.isExpanded());
}
use of org.apache.axiom.soap.SOAPBody in project webservices-axiom by apache.
the class TestAddFault2 method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPBody body = soapFactory.createSOAPBody(envelope);
body.addFault(soapFactory.createSOAPFault());
assertTrue("Body Test:- After calling addFault method, SOAP body has no fault", body.hasFault());
}
use of org.apache.axiom.soap.SOAPBody in project webservices-axiom by apache.
the class TestGetFaultWithParser method runTest.
@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
SOAPBody body = envelope.getBody();
assertNotNull("Body Test With parser :- getFault method returns null", body.getFault());
assertEquals("Body Test With parser : - SOAP fault name mismatch", SOAPConstants.SOAPFAULT_LOCAL_NAME, body.getFault().getLocalName());
}
use of org.apache.axiom.soap.SOAPBody in project webservices-axiom by apache.
the class TestHasFault method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPBody body = soapFactory.createSOAPBody(envelope);
assertFalse("Body Test:- After creating a soap body it has a fault", body.hasFault());
body.addFault(new Exception("This an exception for testing"));
assertTrue("Body Test:- After calling addFault method, hasFault method returns false", body.hasFault());
}
Aggregations