JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setServiceClass(BookService.class);
// Use the HTTP Binding which understands the Java Rest Annotations
sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
sf.setAddress("http://localhost:9080/xml/");
sf.getServiceFactory().setInvoker(new BeanInvoker(serviceObj));
// Turn the "wrapped" style off. This means that CXF won't generate
// wrapper XML elements and we'll have prettier XML text. This
// means that we need to stick to one request and one response
// parameter though.
sf.getServiceFactory().setWrapped(false);
sf.create();
JaxWsServerFactoryBean sfJson = new JaxWsServerFactoryBean();
sfJson.setServiceClass(BookService.class);
// Use the HTTP Binding which understands the Java Rest Annotations
sfJson.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
sfJson.setAddress("http://localhost:9080/json");
sfJson.getServiceFactory().setInvoker(new BeanInvoker(serviceObj));
// Turn the "wrapped" style off. This means that CXF won't generate
// wrapper JSON elements and we'll have prettier JSON text. This
// means that we need to stick to one request and one response
// parameter though.