use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.
the class TestWrongParent2 method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope parent = soapFactory.createSOAPEnvelope();
OMElement child1 = soapFactory.createSOAPHeader(parent);
SOAPFault fault = soapFactory.createSOAPFault();
try {
child1.insertSiblingAfter(fault);
fail("Expected SOAPProcessingException");
} catch (SOAPProcessingException ex) {
// Expected
}
}
use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.
the class TestWrongParent3 method runTest.
@Override
protected void runTest() throws Throwable {
SOAPHeader parent = soapFactory.createSOAPHeader();
OMElement child1 = soapFactory.createSOAPHeaderBlock("child1", soapFactory.createOMNamespace("urn:test", "p"), parent);
SOAPFault fault = soapFactory.createSOAPFault();
try {
child1.insertSiblingBefore(fault);
fail("Expected SOAPProcessingException");
} catch (SOAPProcessingException ex) {
// Expected
}
}
use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.
the class TestAddDetailEntry method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPBody body = soapFactory.createSOAPBody(envelope);
SOAPFault fault = soapFactory.createSOAPFault(body);
SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail(fault);
OMNamespace omNamespace = soapFactory.createOMNamespace("http://www.test.org", "test");
soapFaultDetail.addDetailEntry(soapFactory.createOMElement("DetailEntry1", omNamespace));
soapFaultDetail.addDetailEntry(soapFactory.createOMElement("DetailEntry2", omNamespace));
Iterator<OMElement> iterator = soapFaultDetail.getAllDetailEntries();
OMElement detailEntry1 = iterator.next();
assertNotNull("SOAP Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns empty iterator", detailEntry1);
assertEquals("SOAP Fault Detail Test : - detailEntry1 local name mismatch", "DetailEntry1", detailEntry1.getLocalName());
assertEquals("SOAP Fault Detail Test : - detailEntry1 namespace uri mismatch", "http://www.test.org", detailEntry1.getNamespace().getNamespaceURI());
OMElement detailEntry2 = iterator.next();
assertNotNull("SOAP Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with only one object", detailEntry2);
assertEquals("SOAP Fault Detail Test : - detailEntry2 local name mismatch", "DetailEntry2", detailEntry2.getLocalName());
assertEquals("SOAP Fault Detail Test : - detailEntry2 namespace uri mismatch", "http://www.test.org", detailEntry2.getNamespace().getNamespaceURI());
assertFalse("SOAP Fault Detail Test : - After calling addDetailEntry method twice, getAllDetailEntries method returns an iterator with three objects", iterator.hasNext());
}
use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.
the class TestGetAllDetailEntries method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPBody body = soapFactory.createSOAPBody(envelope);
SOAPFault fault = soapFactory.createSOAPFault(body);
SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail(fault);
OMNamespace omNamespace = soapFactory.createOMNamespace("http://www.test.org", "test");
Iterator<OMElement> iterator = soapFaultDetail.getAllDetailEntries();
assertFalse("SOAP Fault Detail Test : - After creating SOAP11FaultDetail element, it has DetailEntries", iterator.hasNext());
soapFaultDetail.addDetailEntry(soapFactory.createOMElement("DetailEntry", omNamespace));
iterator = soapFaultDetail.getAllDetailEntries();
OMElement detailEntry = iterator.next();
assertNotNull("SOAP Fault Detail Test : - After calling addDetailEntry method, getAllDetailEntries method returns empty iterator", detailEntry);
assertEquals("SOAP Fault Detail Test : - detailEntry local name mismatch", "DetailEntry", detailEntry.getLocalName());
assertEquals("SOAP Fault Detail Test : - detailEntry namespace uri mismatch", "http://www.test.org", detailEntry.getNamespace().getNamespaceURI());
assertFalse("SOAP Fault Detail Test : - After calling addDetailEntry method once, getAllDetailEntries method returns an iterator with two objects", iterator.hasNext());
}
use of org.apache.axiom.soap.SOAPFault in project webservices-axiom by apache.
the class TestSerialization method runTest.
@Override
protected void runTest() throws Throwable {
SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
SOAPBody body = soapFactory.createSOAPBody(envelope);
SOAPFault fault = soapFactory.createSOAPFault(body);
SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail(fault);
OMNamespace omNamespace = soapFactory.createOMNamespace("http://www.test.org", "test");
soapFaultDetail.addDetailEntry(soapFactory.createOMElement("DetailEntry1", omNamespace));
soapFaultDetail.addDetailEntry(soapFactory.createOMElement("DetailEntry2", omNamespace));
StringWriter out = new StringWriter();
soapFaultDetail.serialize(out);
String msg = out.toString();
assertTrue(msg.indexOf("DetailEntry1") != -1);
assertTrue(msg.indexOf("DetailEntry2") != -1);
}
Aggregations