use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class NettyClientTest method testInvocationWithTransportId.
@Test
public void testInvocationWithTransportId() throws Exception {
String address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(Greeter.class);
factory.setAddress(address);
factory.setTransportId("http://cxf.apache.org/transports/http/netty/client");
Greeter greeter = factory.create(Greeter.class);
String response = greeter.greetMe("test");
assertEquals("Get a wrong response", "Hello test", response);
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class UndertowBasicAuthTest method setUp.
@Before
public void setUp() throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
greeter = new SOAPService(wsdl, SERVICE_NAME).getPort(Greeter.class);
BindingProvider bp = (BindingProvider) greeter;
ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "ffang");
bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class UndertowDigestAuthTest method setupClient.
private HTTPConduit setupClient(boolean async) throws Exception {
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
greeter = new SOAPService(wsdl, SERVICE_NAME).getPort(Greeter.class);
BindingProvider bp = (BindingProvider) greeter;
ClientProxy.getClient(greeter).getInInterceptors().add(new LoggingInInterceptor());
ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ADDRESS);
HTTPConduit cond = (HTTPConduit) ClientProxy.getClient(greeter).getConduit();
HTTPClientPolicy client = new HTTPClientPolicy();
client.setConnectionTimeout(600000);
client.setReceiveTimeout(600000);
cond.setClient(client);
if (async) {
if (cond instanceof AsyncHTTPConduit) {
UsernamePasswordCredentials creds = new UsernamePasswordCredentials("ffang", "pswd");
bp.getRequestContext().put(Credentials.class.getName(), creds);
bp.getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);
client.setAutoRedirect(true);
} else {
fail("Not an async conduit");
}
} else {
bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "ffang");
bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");
cond.setAuthSupplier(new DigestAuthSupplier());
}
ClientProxy.getClient(greeter).getOutInterceptors().add(new AbstractPhaseInterceptor<Message>(Phase.PRE_STREAM_ENDING) {
public void handleMessage(Message message) throws Fault {
Map<String, ?> headers = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS));
if (headers.containsKey("Proxy-Authorization")) {
throw new RuntimeException("Should not have Proxy-Authorization");
}
}
});
client.setAllowChunking(false);
return cond;
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class SoapUDPTest method testSOAPUDP.
@Test
public void testSOAPUDP() {
BusFactory.setThreadDefaultBus(staticBus);
Service service = Service.create(serviceName);
service.addPort(localPortName, "http://schemas.xmlsoap.org/soap/", "soap.udp://localhost:" + PORT);
Greeter greeter = service.getPort(localPortName, Greeter.class);
String reply = greeter.greetMe("test");
assertEquals("Hello test", reply);
reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals("Bonjour", reply);
}
use of org.apache.hello_world_soap_http.Greeter in project cxf by apache.
the class JSClientServerTest method testJSMessageMode.
@Test
public void testJSMessageMode() throws Exception {
QName serviceName = new QName(NS, "SOAPService");
QName portName = new QName(NS, "SoapPort");
URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(wsdl);
SOAPService service = new SOAPService(wsdl, serviceName);
assertNotNull(service);
String response1 = new String("TestGreetMeResponse");
String response2 = new String("TestSayHiResponse");
try {
Greeter greeter = service.getPort(portName, Greeter.class);
updateAddressPort(greeter, JS_PORT);
String greeting = greeter.greetMe("TestGreetMeRequest");
assertNotNull("no response received from service", greeting);
assertEquals(response1, greeting);
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals(response2, reply);
} catch (UndeclaredThrowableException ex) {
ex.printStackTrace();
throw (Exception) ex.getCause();
}
}
Aggregations