简体   繁体   English

将类实例部署为Web服务

[英]Deploy a class instance as a web service

I need to programmatically register a specific instance of an interface as a web service. 我需要以编程方式将接口的特定实例注册为Web服务。 (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 相关问题在此处以编程方式启动axis2服务

(Feel free to edit, the answer is not complete:) (随时编辑,答案不完整:)

One way forward may be to use Axis' XFireExporter 一种前进的方式可能是使用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.
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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