use of fromwsdl.soap12.fault.client.handlers.ExceptionThrowingHandler in project metro-jax-ws by eclipse-ee4j.
the class TestApp method testHandlerException1.
/**
* Have a handler throw a protocol exception and make sure
* the proper values are in the soap fault. Test for 6353191.
*/
public void testHandlerException1() throws Exception {
// the expected fault code local part
String code = "Sender";
try {
// clear handlers (should be none) and add helper handler
ClientServerTestUtil.clearHandlers((BindingProvider) stub);
ExceptionThrowingHandler handler = new ExceptionThrowingHandler("ProtocolException");
ClientServerTestUtil.addHandlerToBinding(handler, (BindingProvider) stub);
// make the call
try {
stub.echo("have a nice day");
fail("did not receive any exception");
} catch (SOAPFaultException e) {
SOAPFault fault = e.getFault();
String faultCode = fault.getFaultCode();
assertTrue("fault code should end with \"" + code + "\": " + faultCode, faultCode.endsWith(code));
} catch (Exception e) {
fail("did not receive soap fault exception. received " + e.toString());
}
} finally {
// always clear the handlers
ClientServerTestUtil.clearHandlers((BindingProvider) stub);
}
}
Aggregations