步骤:
一、Create an ObjectServiceFactory
二、Register the bean
三、Expose xfire
public void init(ServletConfig config) throws ServletException {
System.out.println("init service");
/**
•Create an ObjectServiceFactory
•Register the bean
•Expose xfire
* */
//first we create a XFire instance, using the default implementation
//you can register your own implementation via XFireFactory.registerFactory()
XFire xfire = XFireFactory.newInstance().getXFire();
//the default transport manager handles a number of transport mechanisms,
//which is good enough for our needs
ServiceFactory factory = new ObjectServiceFactory(xfire.getTransportManager());
//note that we'd like to specify our own service name, so we use the overloaded
//create method instead of the simpler one that just takes in a class name
Service service = factory.create(serviceimpl.class, "hi", null, null);
//if Hello.class is an interface, then we need to specify the implementation class
service.setProperty(ObjectInvoker.SERVICE_IMPL_CLASS, serviceimpl.class);
ServiceInfo sinfo = service.getServiceInfo();
sinfo.removeOperation("setTest");
Service ss = sinfo.getService();
controller = new XFireServletController(xfire, config.getServletContext());
controller.getServiceRegistry().register(ss);
}