CXF整合Spring通过tomcat发布webservice
1.创建web工程,下载apache-cxf-2.7.18,将apache-cxf-2.7.18下的lib下的jar包加入项目lib中
2.项目中添加Spring(自动添加application.xml文件,以及在web.xml中加入spring监听器)
3.web.xml中添加cxfservlet,并配置拦截/cxf/* (拦截所有cxf请求)
4.编写接口和实现,一定要在接口中添加注解@webservice
5.applicationContext.xml中添加协议
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation中尾部添加 http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
并配置接口实现bean和接口bean
6.访问http://localhost:8080/cxf_server/cxf 即出现webservice服务列表(cxf功能)
7.点进去右边wsdl进入对应webservice
本文介绍如何使用Apache CXF 2.7.18版本整合Spring框架,在Tomcat服务器上部署Webservice应用。主要步骤包括:创建Web工程、添加必要的依赖库、配置Spring上下文、设置CXF Servlet拦截器、编写WebService接口及其实现类、配置Spring管理的Bean以及最终发布服务。

609

被折叠的 条评论
为什么被折叠?



