use of fromwsdl.soap12.fault.client.handlers.MUHelperHandler in project metro-jax-ws by eclipse-ee4j.
the class TestApp method testMustUnderstand2.
/*
* MU test here for soap 1.2. Test verifies that the not
* understood headers are returned to the client as
* headers in the response message.
*/
public void testMustUnderstand2() throws Exception {
String next_1_2 = "http://www.w3.org/2003/05/soap-envelope/role/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 the handler add two headers
QName header1 = new QName("urn:mutest", "badheader1");
QName header2 = new QName("urn:mutest", "badheader2");
handler.setMUHeader(header1, next_1_2);
handler.setMUHeader(header2, next_1_2);
List<QName> expectedHeaders = new ArrayList<QName>();
expectedHeaders.add(header1);
expectedHeaders.add(header2);
handler.setExpectedHeaders(expectedHeaders);
// make the call
try {
stub.echo("have a nice day");
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);
}
}
use of fromwsdl.soap12.fault.client.handlers.MUHelperHandler in project metro-jax-ws by eclipse-ee4j.
the class TestApp method testMustUnderstand1.
/*
* MU test here for soap 1.2. Test uses a simple handler
* on client side to test service with no handlers.
*/
public void testMustUnderstand1() throws Exception {
String next_1_2 = "http://www.w3.org/2003/05/soap-envelope/role/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 = "echo";
assertEquals(arg, stub.echo(arg));
// add header that should result in soap fault
handler.setMUHeader(new QName("urn:mutest", "someheader"), next_1_2);
// make the call
try {
stub.echo(arg);
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