开发者

Deploy a class instance as a web service

开发者 https://www.devze.com 2023-02-18 18:33 出处:网络
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.)

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.
}
0

精彩评论

暂无评论...
验证码 换一张
取 消