use of org.apache.axiom.soap.SOAPFaultDetail 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.SOAPFaultDetail in project webservices-axiom by apache.
the class TestDetailEntriesUsingDefaultNamespaceWithParser method runTest.
@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
SOAPFaultDetail soapFaultDetail = envelope.getBody().getFault().getDetail();
OMElement detailElement = soapFaultDetail.getFirstElement();
assertEquals("AddNumbersHandlerFault", detailElement.getLocalName());
OMNamespace ns = detailElement.getNamespace();
// At some point, there was a bug in Axiom that caused the prefix to be null
assertEquals("", ns.getPrefix());
assertEquals("http://www.example.org/addnumbershandler", ns.getNamespaceURI());
}
use of org.apache.axiom.soap.SOAPFaultDetail in project webservices-axiom by apache.
the class TestGetAllDetailEntriesWithParser method runTest.
@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
SOAPFaultDetail soapFaultDetail = envelope.getBody().getFault().getDetail();
Iterator<OMElement> iterator = soapFaultDetail.getAllDetailEntries();
OMElement detailEntry1 = iterator.next();
assertNotNull("SOAP Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator without detail entries", detailEntry1);
assertEquals("SOAP Fault Detail Test With Parser : - detailEntry1 localname mismatch", "ErrorCode", detailEntry1.getLocalName());
OMElement detailEntry2 = iterator.next();
assertNotNull("SOAP Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with only one detail entries", detailEntry2);
assertEquals("SOAP Fault Detail Test With Parser : - detailEntry2 localname mismatch", "Message", detailEntry2.getLocalName());
assertFalse("SOAP Fault Detail Test With Parser : - getAllDetailEntries method returns an itrator with more than two detail entries", iterator.hasNext());
}
use of org.apache.axiom.soap.SOAPFaultDetail 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.SOAPFaultDetail 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