BusFactory.setDefaultBus(bus);
URL wsdl = this.getClass().getResource("/wsdl_systest_databinding/xmlbeans/hello_world.wsdl");
assertNotNull("We should have found the WSDL here. " , wsdl);
SOAPService ss = new SOAPService(wsdl, SERVICE_NAME);
Greeter port = ss.getSoapPort();
updateAddressPort(port, WSDL_PORT);
String resp;
ClientProxy.getClient(port).getInInterceptors().add(new LoggingInInterceptor());
ClientProxy.getClient(port).getOutInterceptors().add(new LoggingOutInterceptor());
resp = port.sayHi();
assertEquals("We should get the right response", "Bonjour", resp);
resp = port.greetMe("Willem");
assertEquals("We should get the right response", "Hello Willem", resp);
String aresp[] = port.sayHiArray(new String[] {"Dan"});
assertEquals("Hello", aresp[0]);
assertEquals("Dan", aresp[1]);
try {
port.greetMe("fault");
fail("Should have been a fault");
} catch (GreetMeFault ex) {
assertEquals("Some fault detail", ex.getFaultInfo().getGreetMeFaultDetail());
}
try {
resp = port.greetMe("Invoking greetMe with invalid length string, expecting exception...");
fail("We expect exception here");
} catch (WebServiceException ex) {
assertTrue("Get a wrong exception",
ex.getMessage().
indexOf("string length (67) is greater than maxLength facet (30)") >= 0);
}
try {
port.pingMe();
fail("We expect exception here");
} catch (PingMeFault ex) {
FaultDetailDocument detailDocument = ex.getFaultInfo();
FaultDetail detail = detailDocument.getFaultDetail();
assertEquals("Wrong faultDetail major", detail.getMajor(), 2);