Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);
assertEquals(200, responseCode.intValue());
}
public void testXMLFault() throws Exception {
XMLService service = new XMLService(
this.getClass().getResource("/wsdl/hello_world_xml_wrapped.wsdl"), serviceName);
assertNotNull(service);
Greeter greeter = service.getPort(portName, Greeter.class);
try {
greeter.pingMe();
fail("did not catch expected PingMeFault exception");
} catch (PingMeFault ex) {
assertEquals("minor value", 1, ex.getFaultInfo().getMinor());
assertEquals("major value", 2, ex.getFaultInfo().getMajor());
BindingProvider bp = (BindingProvider) greeter;
Map<String, Object> responseContext = bp.getResponseContext();
String contentType = (String) responseContext.get(Message.CONTENT_TYPE);
assertEquals("text/xml", contentType);
Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);
assertEquals(500, responseCode.intValue());
}
Greeter greeterFault = service.getXMLFaultPort();
try {
greeterFault.pingMe();
fail("did not catch expected runtime exception");
} catch (Exception ex) {
assertTrue("check expected message of exception", ex.getMessage().indexOf(