use of org.apache.cxf.service.invoker.BeanInvoker in project cxf by apache.
the class ClientServiceConfigTest method before.
@Before
public void before() throws Exception {
super.setUp();
ReflectionServiceFactoryBean factory = new ReflectionServiceFactoryBean();
factory.setInvoker(new BeanInvoker(new EchoImpl()));
factory.setDataBinding(new AegisDatabinding());
ServerFactoryBean svrFac = new ServerFactoryBean();
svrFac.setAddress("local://Echo");
svrFac.setServiceFactory(factory);
svrFac.setServiceClass(Echo.class);
svrFac.setBus(getBus());
svrFac.create();
Endpoint endpoint = Endpoint.create(new EchoImpl());
impl = (EndpointImpl) endpoint;
impl.setDataBinding(new AegisDatabinding());
endpoint.publish("local://JaxWsEcho");
}
use of org.apache.cxf.service.invoker.BeanInvoker in project cxf by apache.
the class ExceptionTest method testJaxwsServerSimpleClient.
@Test(expected = HelloException.class)
public void testJaxwsServerSimpleClient() throws Exception {
JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
sfbean.setServiceClass(ExceptionService.class);
sfbean.setDataBinding(new AegisDatabinding());
sfbean.setAddress("local://ExceptionServiceJaxWs1");
Server server = sfbean.create();
Service service = server.getEndpoint().getService();
service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));
ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
proxyFac.setAddress("local://ExceptionServiceJaxWs1");
proxyFac.setBus(getBus());
setupAegis(proxyFac.getClientFactoryBean());
ExceptionService clientInterface = proxyFac.create(ExceptionService.class);
clientInterface.sayHiWithException();
}
use of org.apache.cxf.service.invoker.BeanInvoker in project cxf by apache.
the class ExceptionTest method testJaxws.
@Test(expected = HelloException.class)
public void testJaxws() throws Exception {
JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
sfbean.setServiceClass(ExceptionService.class);
setupAegis(sfbean);
sfbean.setAddress("local://ExceptionService4");
Server server = sfbean.create();
Service service = server.getEndpoint().getService();
service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setAddress("local://ExceptionService4");
proxyFac.setBus(getBus());
setupAegis(proxyFac.getClientFactoryBean());
ExceptionService clientInterface = proxyFac.create(ExceptionService.class);
clientInterface.sayHiWithException();
}
use of org.apache.cxf.service.invoker.BeanInvoker in project cxf by apache.
the class EndpointImplTest method testSOAPBindingOnMethodWithRPC.
@Test
public void testSOAPBindingOnMethodWithRPC() {
HelloWrongAnnotation hello = new HelloWrongAnnotation();
JaxWsServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
serviceFactory.setBus(getBus());
serviceFactory.setInvoker(new BeanInvoker(hello));
serviceFactory.setServiceClass(HelloWrongAnnotation.class);
try {
new EndpointImpl(getBus(), hello, new JaxWsServerFactoryBean(serviceFactory)).close();
} catch (Exception e) {
String expeced = "Method [sayHi] processing error: SOAPBinding can not on method with RPC style";
assertEquals(expeced, e.getMessage());
}
}
use of org.apache.cxf.service.invoker.BeanInvoker in project cxf by apache.
the class EndpointImplTest method testEndpointServiceConstructor.
@Test
public void testEndpointServiceConstructor() throws Exception {
GreeterImpl greeter = new GreeterImpl();
JaxWsServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
serviceFactory.setBus(getBus());
serviceFactory.setInvoker(new BeanInvoker(greeter));
serviceFactory.setServiceClass(GreeterImpl.class);
try (EndpointImpl endpoint = new EndpointImpl(getBus(), greeter, new JaxWsServerFactoryBean(serviceFactory))) {
WebServiceContext ctx = greeter.getContext();
assertNull(ctx);
try {
String address = "http://localhost:8080/test";
endpoint.publish(address);
} catch (IllegalArgumentException ex) {
assertTrue(ex.getCause() instanceof BusException);
assertEquals("BINDING_INCOMPATIBLE_ADDRESS_EXC", ((BusException) ex.getCause()).getCode());
}
ctx = greeter.getContext();
assertNotNull(ctx);
}
}
Aggregations