简单CXF操作之整合spring(二)
来源:互联网 发布:淘宝店铺自动回复语 编辑:程序博客网 时间:2024/06/01 08:10
服务器端
接口
package test.cxf.server;import javax.jws.WebService;@WebServicepublic interface HelloCXF { public String say(String name);}
实现
package test.cxf.server;import javax.jws.WebService;@WebService(endpointInterface="test.cxf.server.HelloCXF")public class HelloCXFImpl implements HelloCXF {public String say(String name) {String str="hello,"+name+",this is my first cxf!";return str;}}web.xml
<?xml version="1.0" encoding="UTF-8"?><web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>AA</display-name><welcome-file-list><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list> <servlet> <servlet-name>CXFServlet</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/service/*</url-pattern> </servlet-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:bean.xml</param-value> </context-param> </web-app>bean.xml
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsd http://cxf.apache.org/jaxwshttp://cxf.apache.org/schemas/jaxws.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml"/> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> <jaxws:endpoint id="hellocxf" address="/hellocxf" implementor="test.cxf.server.HelloCXFImpl" /> </beans>
命令:wsdl2java -client -p test.cxf.client -d e:/ http://localhost/AA/service/hellocxf?wsdl (ps:我的项目名叫AA)
生成客户端,放到项目里直接运行xxx_Client.java,可看到运行结果
生成客户端文件
jar包
0 0
- 简单CXF操作之整合spring(二)
- CXF系列(四):CXF整合spring
- CXF系列(四):CXF整合spring
- Spring 3之MVC & Security简单整合开发(二)
- Spring 3之MVC & Security简单整合开发(二)
- Spring 3之MVC & Security简单整合开发(二)
- Spring 3之MVC & Security简单整合开发(二)
- CXF整合spring(客户端)
- webService之(五)Spring与CXF整合
- (五)WebService之CXF和Spring整合
- WS之cxf与spring整合1
- WS之cxf与spring整合2
- WebService之CXF与Spring的整合
- CXF整合Spring之JaxWsProxyFactoryBean调用
- webservice学习之cxf框架-spring整合
- Spring整合CXF之发布WebService服务
- Spring整合CXF之发布WebService服务
- Spring整合CXF之添加拦截器
- Android - Bitmap-内存分析
- springMVC动态生成验证码过程
- unity3d事件函数整理,事件,回调函数,消息处理
- Activity 启动过程
- .NET网站运行,无效的DateTime错误
- 简单CXF操作之整合spring(二)
- TBB介绍
- Linux开启mysql远程连接的设置步骤
- c++特性:auto
- java学习笔记(二)
- UILable获取字符串高度,自适应
- Struts2+AJAX获取json数据
- windows下安装mongodb
- 10个经典C语言面试基础算法