cxf 发布多个接口的方法
来源:互联网 发布:淘宝投诉盗图原图太大 编辑:程序博客网 时间:2024/06/03 18:10
cxf 发布多个接口的方法
转自:http://hbiao68.iteye.com/blog/1980266
实际应用中,我们可以把webservice集成到项目中:
http://blog.csdn.net/qq_21399933/article/details/78828913
1、使用cxf 中的 JaxWsServerFactoryBean类发布webservice
package server; import org.apache.cxf.jaxws.JaxWsServerFactoryBean; import hb.HelloWorldService; import hb.IHelloWorldService; import hb.ISessionSendMsg; import hb.SessionSendMsg; public class Server1 { public static void main(String[] args) { HelloWorldService helloworldimp = new HelloWorldService(); JaxWsServerFactoryBean factoryBean = new JaxWsServerFactoryBean(); factoryBean.setAddress("http://localhost:8080/WSCXF/helloService"); factoryBean.setServiceClass(IHelloWorldService.class);//接口类 factoryBean.setServiceBean(helloworldimp); factoryBean.create(); JaxWsServerFactoryBean factoryBean1 = new JaxWsServerFactoryBean(); SessionSendMsg sessionSendMsg = new SessionSendMsg(); factoryBean1.setAddress("http://localhost:8080/WSCXF/sessionService"); factoryBean1.setServiceClass(ISessionSendMsg.class);//接口类 factoryBean1.setServiceBean(sessionSendMsg); factoryBean1.create(); } }
备注:实际上是创建了多个JaxWsServerFactoryBean对象来实现发布多个接口
2、使用java原生代码发布webservice
package server; import hb.HelloWorldService; import hb.SessionSendMsg; import javax.xml.ws.Endpoint; public class DeployHelloWorldService { public static void main(String[] args) { System.out.println("Server start ……"); HelloWorldService service = new HelloWorldService(); String address = "http://localhost:9000/helloWorld"; Endpoint.publish(address, service); SessionSendMsg sessionSendMsg = new SessionSendMsg(); String address1 = "http://localhost:9000/session"; Endpoint.publish(address1, sessionSendMsg); } }
备注:实际上是Endpoint发布多次实现发布多个接口。
阅读全文
0 0
- cxf 发布多个接口的方法
- cxf 发布多个接口的方法
- CXF发布restful接口
- cxf+spring发布webservice接口及接口的调用
- cxf+spring发布webservice接口及接口的调用
- cxf+spring发布webservice接口及接口的调用
- cxf+spring发布webservice接口及接口的调用
- CXF 入门:HelloWorld接口发布
- 使用CXF发布服务接口
- spring整合cxf方式发布的rest webservice,调用接口
- 使用cxf发布rest服务接口,和spring的整合
- 使用CXF发布基于maven的REST webservice接口
- springboot的junit测试和多个模块cxf暴露接口问题
- 基于web的cxf的第二种发布方式——带有接口的发布方式
- 基于web的cxf的第二种发布方式——带有接口的发布方式
- webservices——发布CXF的方法总结!!!
- webservices——发布CXF的方法总结!!!
- CXF的三种发布方式和客户端调用方法
- 关于代理
- FreeBASIC学习笔记——第05章 数组
- mybatis 模糊查询的实现方法
- 2017前端经典框架
- 软考中级 —— 数据库系统
- cxf 发布多个接口的方法
- Springmvc自定义过滤器Filter,解决跨域问题
- java8-lambda语法
- 连通域染色,two-pass算法的并查集实现
- vue基于webpack 模板的目录结构
- 侧滑菜单DrawerLayout
- 面向小数据集构建图像分类模型
- Linux Regulator Framework(1)_概述
- [运维] CentOS7 开机启动Tomcat 服务