use of org.apache.hello_world_soap_http.SOAPServiceBogusAddressTest in project cxf by apache.
the class ClientServerTest method testBogusAddress.
@Test
public void testBogusAddress() throws Exception {
String realAddress = "http://localhost:" + BOGUS_REAL_PORT + "/SoapContext/SoapPort";
SOAPServiceBogusAddressTest service = new SOAPServiceBogusAddressTest();
Greeter greeter = service.getSoapPort();
try {
greeter.greetMe("test");
fail("Should fail");
} catch (WebServiceException f) {
// expected
}
BindingProvider bp = (BindingProvider) greeter;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, realAddress);
greeter.greetMe("test");
// should persist
greeter.greetMe("test");
bp.getRequestContext().remove(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
try {
greeter.greetMe("test");
fail("Should fail");
} catch (WebServiceException f) {
// expected
}
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, realAddress);
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals("Bonjour", reply);
}
Aggregations