use of org.apache.cxf.frontend.ClientProxyFactoryBean in project cxf by apache.
the class RountripTest method testServerFactoryBean.
@Test
public void testServerFactoryBean() throws Exception {
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress("http://localhost/Hello");
svrBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
svrBean.setServiceBean(new HelloServiceImpl());
svrBean.setServiceClass(HelloService.class);
svrBean.setBus(getBus());
svrBean.create();
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress("http://localhost/Hello");
clientBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
clientBean.setServiceClass(HelloService.class);
clientBean.setBus(getBus());
HelloService client = (HelloService) proxyFactory.create();
assertEquals("hello", client.sayHello());
assertEquals("hello", client.echo("hello"));
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project camel by apache.
the class FailOverFeatureTest method tryFailover.
private String tryFailover(String url) {
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setServiceClass(HelloService.class);
factory.setAddress(url);
HelloService client = (HelloService) factory.create();
return client.sayHello();
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project camel by apache.
the class CxfPayLoadBareSoapTest method testInvokeProxyService.
@Test
public void testInvokeProxyService() {
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setServiceClass(BareSoapService.class);
factory.setAddress(PROXY_URL);
factory.setBus(BusFactory.newInstance().createBus());
BareSoapService client = (BareSoapService) factory.create();
client.doSomething();
assertEquals("Proxied service should have been invoked once", 1, IMPLEMENTATION.invocations.get());
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project camel by apache.
the class LoadDistributorFeatureTest method tryLoadDistributor.
private String tryLoadDistributor(String url) {
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setServiceClass(HelloService.class);
factory.setAddress(url);
HelloService client = (HelloService) factory.create();
return client.sayHello();
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project camel by apache.
the class LoggingInterceptorInMessageModeTest method testInvokingServiceFromCXFClient.
@Test
public void testInvokingServiceFromCXFClient() throws Exception {
LoggingOutInterceptor logInterceptor = null;
for (Interceptor<?> interceptor : context.getEndpoint("cxf:bean:serviceEndpoint", CxfSpringEndpoint.class).getOutInterceptors()) {
if (interceptor instanceof LoggingOutInterceptor) {
logInterceptor = LoggingOutInterceptor.class.cast(interceptor);
break;
}
}
assertNotNull(logInterceptor);
// StringPrintWriter writer = new StringPrintWriter();
// Unfortunately, LoggingOutInterceptor does not have a setter for writer so
// we can't capture the output to verify.
// logInterceptor.setPrintWriter(writer);
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress(ROUTER_ADDRESS);
clientBean.setServiceClass(HelloService.class);
HelloService client = (HelloService) proxyFactory.create();
String result = client.echo("hello world");
assertEquals("we should get the right answer from router", result, "echo hello world");
//assertTrue(writer.getString().indexOf("hello world") > 0);
}
Aggregations