CXF Without Spring, using CXFNonSpringServlet and JaxWsServerFactoryBean
Here's how you'd serve up a web service using CXF but without using Spring, using CXFNonSpringServlet and JaxWsServerFactoryBean.
public class MyServiceServlet extends CXFNonSpringServlet {
private static final long serialVersionUID = 1L;
@Override
// Called at startup time to register this web service.
public void loadBus(ServletConfig servletConfig) {
super.loadBus(servletConfig);
Bus bus = getBus();
BusFactory.setDefaultBus(bus);
createFactoryBean();
}
private void createFactoryBean() {
JaxWsServerFactoryBean fb = new JaxWsServerFactoryBean();
fb.setWsdlLocation("myservice.wsdl");
fb.setAddress("/");
fb.setServiceBean(new MyServicePortImpl());
fb.setServiceClass(MyServicePort.class);
fb.setServiceName(new QName("http://www.example.com/MyService", "MyService"));
fb.create();
}
}