Deploy a class instance as a web service
I need to programmatically register a specific instance of an interface as a web service. (The reason is that its a dynamically generated implementation using proxies.)
Something like the following:
public <T, U extends T> void registerWebService(U implementation, Class<T> interfaceType);
related question here Starting an axis2 service programmatical开发者_JAVA技巧ly
(Feel free to edit, the answer is not complete:)
One way forward may be to use Axis' XFireExporter
public <T, U extends T> void registerWebService(U implementation, Class<T> interfaceType) {
XFire xfire = XFireFactory.newInstance().getXFire();
XFireExporter e = new XFireExporter();
e.setXfire(xfire);
e.setServiceInterface(interfaceType);
e.setServiceBean(implementation);
e.afterPropertiesSet();
e.getServiceBean();
//TODO: register with a WebApplicationContext somehow.
}
精彩评论