use of fromwsdl.wsdl_hello_lit.client.handlers.MUHelperHandler in project metro-jax-ws by eclipse-ee4j.
the class HelloLiteralTest method testMustUnderstand1.
/*
* MU test here for soap 1.1. Test uses a simple handler
* on client side to test service with no handlers.
*/
public void testMustUnderstand1() throws Exception {
String next_1_1 = "http://schemas.xmlsoap.org/soap/actor/next";
try {
// clear handlers (should be none) and add helper handler
ClientServerTestUtil.clearHandlers((BindingProvider) stub);
MUHelperHandler handler = new MUHelperHandler();
ClientServerTestUtil.addHandlerToBinding(handler, (BindingProvider) stub);
// have handler set header that is ignored
handler.setMUHeader(new QName("urn:mutest", "someheader"), "notarealactor");
// make the call
String arg = "foo";
Hello_Type req = new Hello_Type();
req.setArgument(arg);
HelloResponse response = stub.hello(req);
assertEquals(arg, response.getArgument());
// add header that should result in soap fault
handler.setMUHeader(new QName("urn:mutest", "someheader"), next_1_1);
// make the call
try {
response = stub.hello(req);
fail("did not receive any exception");
} catch (ProtocolException e) {
if (e instanceof SOAPFaultException) {
// pass
} else {
fail("did not receive soap fault, received: " + e.toString());
}
} catch (Exception e) {
fail("did not receive protocol exception. received " + e.toString());
}
} finally {
// always clear the handlers
ClientServerTestUtil.clearHandlers((BindingProvider) stub);
}
}
Aggregations