use of org.apache.cxf.jaxws.JaxWsServerFactoryBean 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.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class BraveTraceTest method createServer.
private static Server createServer(Feature logging) {
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setAddress(ADDRESS);
factory.setServiceBean(new MyServiceImpl());
factory.setFeatures(Arrays.asList(logging));
return factory.create();
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class MDBActivationWork method createServer.
private Server createServer(Bus bus, Class<?> serviceClass, MDBInvoker invoker) {
// create server bean factory
final ServerFactoryBean factory;
if (serviceClass != null && EndpointUtils.hasWebServiceAnnotation(serviceClass)) {
factory = new JaxWsServerFactoryBean();
} else {
factory = new ServerFactoryBean();
}
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Creating a server using " + factory.getClass().getName());
}
if (serviceClass != null) {
factory.setServiceClass(serviceClass);
}
if (spec.getWsdlLocation() != null) {
factory.setWsdlLocation(spec.getWsdlLocation());
}
if (spec.getAddress() != null) {
factory.setAddress(spec.getAddress());
}
factory.setBus(bus);
if (spec.getEndpointName() != null) {
factory.setEndpointName(QName.valueOf(spec.getEndpointName()));
}
if (spec.getSchemaLocations() != null) {
factory.setSchemaLocations(getListOfString(spec.getSchemaLocations()));
}
if (spec.getServiceName() != null) {
factory.setServiceName(QName.valueOf(spec.getServiceName()));
}
factory.setInvoker(invoker);
// Don't start the server yet
factory.setStart(false);
final Server retval;
if (factory instanceof JaxWsServerFactoryBean) {
retval = createServerFromJaxwsEndpoint((JaxWsServerFactoryBean) factory);
} else {
retval = factory.create();
}
return retval;
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class StudentTest method testReturnMapDocLiteral.
@Test
public void testReturnMapDocLiteral() throws Exception {
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setServiceClass(StudentServiceDocLiteral.class);
sf.setServiceBean(new StudentServiceDocLiteralImpl());
sf.setAddress("local://StudentServiceDocLiteral");
setupAegis(sf);
Server server = sf.create();
server.start();
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setAddress("local://StudentServiceDocLiteral");
proxyFac.setBus(getBus());
setupAegis(proxyFac.getClientFactoryBean());
StudentServiceDocLiteral clientInterface = proxyFac.create(StudentServiceDocLiteral.class);
Map<Long, Student> fullMap = clientInterface.getStudentsMap();
assertNotNull(fullMap);
Student one = fullMap.get(Long.valueOf(1));
assertNotNull(one);
assertEquals("Student1", one.getName());
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class StudentTest method testReturnMap.
@Test
public void testReturnMap() throws Exception {
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setServiceClass(StudentService.class);
sf.setServiceBean(new StudentServiceImpl());
sf.setAddress("local://StudentService");
setupAegis(sf);
Server server = sf.create();
server.start();
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setAddress("local://StudentService");
proxyFac.setBus(getBus());
setupAegis(proxyFac.getClientFactoryBean());
StudentService clientInterface = proxyFac.create(StudentService.class);
Map<Long, Student> fullMap = clientInterface.getStudentsMap();
assertNotNull(fullMap);
Student one = fullMap.get(Long.valueOf(1));
assertNotNull(one);
assertEquals("Student1", one.getName());
Map<String, ?> wildMap = clientInterface.getWildcardMap();
assertEquals("valuestring", wildMap.get("keystring"));
}
Aggregations