2011-03-22 117 views
0

我需要以编程方式将接口的特定实例注册为Web服务。 (原因是,使用代理服务器的动态生成的实现。)将类实例部署为Web服务

类似以下内容:

public <T, U extends T> void registerWebService(U implementation, Class<T> interfaceType);

这里

相关的问题 Starting an axis2 service programmatically

+0

Web服务应由嵌入式HttpServer处理。 (SimpleHttpServer,Jetty,Tomcat等) – Hugo 2011-03-22 09:02:57

回答

0

(随意编辑,答案是不完整:)

单向前进可能是使用安讯士的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

嗨雨果,你能找到一个完整的解决方案如何做到这一点?我想实现类似的东西。谢谢,Viktor – Viktor 2013-09-02 15:48:41