欢迎来到天天文库
浏览记录
ID:13892414
大小:257.56 KB
页数:8页
时间:2018-07-24
《五、cxf webservice整合spring》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、五、CXFWebService整合Spring首先,CXF和spring整合需要准备如下jar包文件:这边我是用Spring的jar包是Spring官方提供的,并没有使用CXF中的Spring的jar文件。添加这么多文件后,首先在web.xml中添加如下配置:org.springframework.web.context.ContextLoaderListener2、ontext-param>contextConfigLocationclasspath*:applicationContext-server.xmlorg.springframework.web.util.IntrospectorCleanupListenerCXFServi3、ceorg.apache.cxf.transport.servlet.CXFServletCXFService/*然后在src目录中,新建一个applicationContext-server.xml文件,文件内容如下:4、="UTF-8"?>5、ns>http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsdhttp://cxf.apache.org/jaxwshttp://cxf.apache.org/schemas/jaxws.xsd"注意上面的带下划线加粗部分,这个很重要的哦!不能写错或是遗漏了。添加完这6、个文件后,还需要在这个文件中导入这么几个文件。文件内容如下:下面开始写服务器端代码,首先定制服务器端的接口,代码如下:packagecom.hoo.service;importjavax.jws.WebParam;imp7、ortjavax.jws.WebService;importjavax.jws.soap.SOAPBinding;importjavax.jws.soap.SOAPBinding.Style;importcom.hoo.entity.User;importcom.hoo.entity.Users;/***function:定制客户端请求WebService所需要的接口*@authorhoojo*@createDate2011-3-18上午08:22:55*@fileComplexUserService.java*@packagecom.hoo.s8、ervice*@projectCXFW
2、ontext-param>contextConfigLocationclasspath*:applicationContext-server.xmlorg.springframework.web.util.IntrospectorCleanupListenerCXFServi
3、ceorg.apache.cxf.transport.servlet.CXFServletCXFService/*然后在src目录中,新建一个applicationContext-server.xml文件,文件内容如下:
4、="UTF-8"?>5、ns>http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsdhttp://cxf.apache.org/jaxwshttp://cxf.apache.org/schemas/jaxws.xsd"注意上面的带下划线加粗部分,这个很重要的哦!不能写错或是遗漏了。添加完这6、个文件后,还需要在这个文件中导入这么几个文件。文件内容如下:下面开始写服务器端代码,首先定制服务器端的接口,代码如下:packagecom.hoo.service;importjavax.jws.WebParam;imp7、ortjavax.jws.WebService;importjavax.jws.soap.SOAPBinding;importjavax.jws.soap.SOAPBinding.Style;importcom.hoo.entity.User;importcom.hoo.entity.Users;/***function:定制客户端请求WebService所需要的接口*@authorhoojo*@createDate2011-3-18上午08:22:55*@fileComplexUserService.java*@packagecom.hoo.s8、ervice*@projectCXFW
5、ns>http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsdhttp://cxf.apache.org/jaxwshttp://cxf.apache.org/schemas/jaxws.xsd"注意上面的带下划线加粗部分,这个很重要的哦!不能写错或是遗漏了。添加完这
6、个文件后,还需要在这个文件中导入这么几个文件。文件内容如下:下面开始写服务器端代码,首先定制服务器端的接口,代码如下:packagecom.hoo.service;importjavax.jws.WebParam;imp
7、ortjavax.jws.WebService;importjavax.jws.soap.SOAPBinding;importjavax.jws.soap.SOAPBinding.Style;importcom.hoo.entity.User;importcom.hoo.entity.Users;/***function:定制客户端请求WebService所需要的接口*@authorhoojo*@createDate2011-3-18上午08:22:55*@fileComplexUserService.java*@packagecom.hoo.s
8、ervice*@projectCXFW
此文档下载收益归作者所有