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:" + PORT + "/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();
//book service in wrapped style
BookServiceWrappedImpl serviceWrappedObj = new BookServiceWrappedImpl();
JaxWsServerFactoryBean sfWrapped = new JaxWsServerFactoryBean();
sfWrapped.setServiceClass(BookServiceWrapped.class);
// Use the HTTP Binding which understands the Java Rest Annotations
sfWrapped.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
sfWrapped.setAddress("http://localhost:" + PORT + "/xmlwrapped");
sfWrapped.getServiceFactory().setInvoker(new BeanInvoker(serviceWrappedObj));
sfWrapped.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:" + PORT + "/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.