try {
greeter.sayHi();
fail("Did not receive expected PolicyException.");
} catch (WebServiceException wex) {
PolicyException ex = (PolicyException)wex.getCause();
assertEquals("INCOMPATIBLE_HTTPCLIENTPOLICY_ASSERTIONS", ex.getCode());
}
// greetMeOneWay - no message or operation policies
greeter.greetMeOneWay("CXF");
// greetMe - operation policy specifies receive timeout and should cause every
// other invocation to fail
assertEquals("CXF", greeter.greetMe("cxf"));
try {
greeter.greetMe("cxf");
fail("Didn't get the exception");
} catch (Exception ex) {
//ex.printStackTrace();
assertTrue(ex.getCause().getClass().getName(), ex.getCause() instanceof SocketTimeoutException);
}
// pingMe - policy attached to binding operation fault should have no effect
try {
greeter.pingMe();
fail("Expected PingMeFault not thrown.");
} catch (PingMeFault ex) {
assertEquals(2, (int)ex.getFaultInfo().getMajor());
assertEquals(1, (int)ex.getFaultInfo().getMinor());
}
}