简体   繁体   中英

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 programmatically

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM