SOAPFault soapFault = sfe.getFault();
assertNotNull(soapFault);
assertEquals("hello world2", soapFault.getFaultString());
assertEquals("actor2", soapFault.getFaultActor());
assertNotNull(soapFault.getDetail());
DetailEntry de = (DetailEntry) soapFault.getDetail().getDetailEntries().next();
assertNotNull(de);
assertEquals("urn://sample", de.getNamespaceURI());
assertEquals("detailEntry", de.getLocalName());
assertEquals("Texas", de.getValue());
// Repeat to verify behavior
try{
exception = null;
// the invoke will throw an exception, if the test is performed right
int total = proxy.throwFault(2, "SOAPFaultException2", 2); // "SOAPFaultException" will cause service to throw SOAPFaultException
}catch(SOAPFaultException e){
// Okay
exception = e;
} catch (Exception e) {
fail("Did not get a SOAPFaultException");
}
TestLogger.logger.debug("----------------------------------");
assertNotNull(exception);
sfe = (SOAPFaultException) exception;
soapFault = sfe.getFault();
assertNotNull(soapFault);
assertEquals("hello world2", soapFault.getFaultString());
assertEquals("actor2", soapFault.getFaultActor());
assertNotNull(soapFault.getDetail());
de = (DetailEntry) soapFault.getDetail().getDetailEntries().next();
assertNotNull(de);
assertEquals("urn://sample", de.getNamespaceURI());
assertEquals("detailEntry", de.getLocalName());
assertEquals("Texas", de.getValue());
}