CXF 在Spring中开发服务端步骤
来源:互联网 发布:算法第四版 epub 编辑:程序博客网 时间:2024/05/16 10:02
1,导入jar 包
<!-- cxf --><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-api</artifactId><version>2.7.7</version></dependency><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-frontend-jaxws</artifactId><version>2.7.7</version></dependency><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-bindings-soap</artifactId><version>2.7.7</version></dependency><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-transports-http</artifactId><version>2.7.7</version></dependency><dependency><groupId>org.apache.cxf</groupId><artifactId>cxf-rt-ws-security</artifactId><version>2.7.7</version></dependency><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpcore</artifactId><version>4.3</version></dependency><dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore-nio</artifactId> <version>4.3</version></dependency><dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpasyncclient</artifactId> <version>4.0-beta4</version></dependency><!-- cxf -->
2.写接口
package com.sharp.hibernatedemo.ws;import javax.jws.WebService;import javax.jws.soap.SOAPBinding;import com.sharp.hibernatedemo.domain.User;@WebService@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)public interface IUserServiceWs{void addUser(User user);}
3.写实现类
package com.sharp.hibernatedemo.ws.impl;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Component;import com.sharp.hibernatedemo.domain.User;import com.sharp.hibernatedemo.service.IUserService;import com.sharp.hibernatedemo.ws.IUserServiceWs;@Component("userServiceWs")public class UserServiceWsImpl implements IUserServiceWs{@Autowiredprivate IUserService userService;public void addUser(User user){userService.addUser(user);}}
4.配置spring-ws.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:p="http://www.springframework.org/schema/p"xmlns:jaxws="http://cxf.apache.org/jaxws"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsdhttp://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-servlet.xml" /><jaxws:server id="userServiceWss"serviceClass="com.sharp.hibernatedemo.ws.IUserServiceWs"address="/userServiceWs"><jaxws:serviceBean><ref bean="userServiceWs" /> <!-- 和上面的id名字一定不要重复了 --></jaxws:serviceBean></jaxws:server></beans>
- CXF 在Spring中开发服务端步骤
- spring和cxf整合开发Webservice步骤
- Spring实现CXF服务端
- spring集成CXF服务端
- CXF 在spring中配置
- CXF接口服务端开发
- CXF WebService 服务端开发
- CXF与Spring集成服务端
- spring整合cxf 客户端+服务端
- spring整合cxf webService(服务端)
- CXF+Spring+Maven之服务端
- cxf+spring创建webservice服务端
- cxf整合Spring框架进行服务端开发,并且通过cxf生成客户端代码进行调用
- 在spring中集成webservice 框架 CXF
- Spring中AOP开发步骤
- CXF WebService服务端成功(集成spring)
- cxf依赖spring 方式实现webservice服务端
- spring与CXF整合配置(服务端)
- 各种服务名称和对应端口号
- 【Rails学习笔记】用户关注功能(二)
- WebService的两种方式SOAP和REST比较
- win7连接ubuntu的远程桌面的技巧
- HTTP请求头概述
- CXF 在Spring中开发服务端步骤
- 笔记9:GraphicsPath对象
- merge两个有序数组,合并之后仍保持有序
- 都有哪些问题?
- PHP之APC缓存详细介绍(转)
- 漂亮的表格样式(使用CSS样式表控制表格样式)
- TotoiseSVN的基本使用方法
- iPhone开发的一些资源
- nosql