use of org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy in project cxf by apache.
the class WSAFromWSDLTest method getPort.
private AddNumbersPortTypeProxy getPort() throws Exception {
URL wsdl = getClass().getResource("/wsdl_systest_wsspec/add_numbers.wsdl");
assertNotNull("WSDL is null", wsdl);
AddNumbersService service = new AddNumbersService(wsdl, serviceName);
assertNotNull("Service is null ", service);
AddNumbersPortTypeProxy port = service.getAddNumbersPort(new AddressingFeature());
updateAddressPort(port, PORT);
return port;
}
use of org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy in project cxf by apache.
the class WSAFromWSDLTest method testAddNumbersFault3.
@Test
public void testAddNumbersFault3() throws Exception {
ByteArrayOutputStream input = setupInLogging();
ByteArrayOutputStream output = setupOutLogging();
try (AddNumbersPortTypeProxy port = getPort()) {
try {
port.addNumbers3(-1, 2);
} catch (AddNumbersFault_Exception ex) {
assert true;
} catch (Exception e) {
e.printStackTrace();
assert false;
}
String expectedOut = "3in";
String expectedIn = "3fault";
assertTrue(output.toString(), output.toString().indexOf(expectedOut) != -1);
assertTrue(input.toString(), input.toString().indexOf(expectedIn) != -1);
}
}
use of org.apache.cxf.systest.ws.addr_feature.AddNumbersService.AddNumbersPortTypeProxy in project cxf by apache.
the class WSAFromWSDLTest method testNonAnonToAnon.
@Test
public void testNonAnonToAnon() throws Exception {
try (AddNumbersPortTypeProxy port = getPort()) {
port.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + PORT + "/jaxws/addAnon");
AddressingProperties maps = new AddressingProperties();
EndpointReferenceType ref = new EndpointReferenceType();
AttributedURIType add = new AttributedURIType();
add.setValue("http://localhost:" + INVALID_PORT + "/not/a/real/url");
ref.setAddress(add);
maps.setReplyTo(ref);
maps.setFaultTo(ref);
port.getRequestContext().put("javax.xml.ws.addressing.context", maps);
try {
port.addNumbers3(-1, 2);
} catch (SOAPFaultException e) {
assertTrue(e.getFault().getFaultCode().contains("OnlyAnonymousAddressSupported"));
}
}
}
Aggregations