webservice的cxf和spring整合客户端开发
1、新建一个java项目
2、导入cxf相关的jar包,并部署到项目中
3、用命令生成客户端使用说明文档
wsdl2java -p com.xiaostudy -d . http://127.0.0.1:8080/demo12/ws/number?wsdl
4、编写applicationContext.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:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
<jaxws:client id="client" address="http://127.0.0.1:8080/demo12/ws/number" serviceClass="com.xiaostudy.TestServiceImpl"/>
</beans>
5、开启客户端
package com.xiaostudy; import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; /**
* @desc 客户端
* @author xiaostudy
*
*/
public class MyClient { public static void main(String[] args) { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
TestServiceImpl testServiceImpl = (TestServiceImpl)applicationContext.getBean("client");
System.out.println(testServiceImpl);
String string = testServiceImpl.getNumber("666");
System.out.println(string);
} }
6、运行客户端,看是否成功
webservice的cxf和spring整合客户端开发的更多相关文章
- 【WebService】WebService之CXF和Spring整合(六)
前面介绍了WebService与CXF的使用,项目中我们经常用到Spring,这里介绍CXF与Spring整合 步骤 1.创建一个Maven Web项目,可以参照:[Maven]Eclipse 使用M ...
- webservice的cxf和spring整合发布
1.新建一个web项目 2.导入cxf相应的jar包,并部署到项目中 3.服务接口 package com.xiaostudy; /** * @desc 服务器接口 * @author xiaostu ...
- Java WebService 教程系列之 Spring 整合 CXF
Java WebService 教程系列之 Spring 整合 CXF 一.引入 jar 包 <dependency> <groupId>org.apache.cxf</ ...
- 浅谈WebService之JAX-RS与spring整合
背景:首先谈一下webservice: 1.Web service是一个平台独立的,低耦合的,自包含的.基于可编程的web的应用程序, 可使用开放的XML(标准通用标记语言下的一个子集)标准来描述.发 ...
- CXF和spring整合遇到的问题:No bean named 'cxf' is defined
今天在做ws和spring整合的时候,很不幸的遇到了这个问题,百度了好久,竟然没人遇到这个问题,后来谷歌了一下,都是遇到这个问题的了...在看到一篇文章中提到了cxf.xml,所以我果断的打开这个配置 ...
- Spring整合web开发
正常整合Servlet和Spring没有问题的 public class UserServlet extends HttpServlet { public void doGet(HttpServlet ...
- 随便聊聊 SOA & SOAP & WebService 的一些东西,以及客户端开发的代码逻辑解析
http://blog.csdn.net/hikaliv/article/details/6459779 一天的时间调通了一个 WebService 的 Java 端的 C/S.一个 Android ...
- WS之cxf与spring整合1
1.在web.xml中加入CXFServlet: <!-- 下面表示所有来自/cxfservice/*的请求,都交给 CXFServlet来处理 .--> <servlet> ...
- CXF、Spring整合的SOAP Web Service服务端
1.建工程,导入CXFjar包 2.服务接口 package com.cxf.soap; import java.util.List; import javax.jws.WebService; @We ...
随机推荐
- closure--- 闭包与并行运算
闭包有效的减少了函数所需定义的参数数目.这对于并行运算来说有重要的意义.在并行运算的环境下,我们可以让每台电脑负责一个函数,然后将一台电脑的输出和下一台电脑的输入串联起来.最终,我们像流水线一样工 ...
- Storm-源码分析-Stats (backtype.storm.stats)
会发现, 现在storm里面有两套metrics系统, metrics framework和stats framework 并且在所有地方都是同时注册两套, 貌似准备用metrics来替代stats, ...
- Linux 搭建Git服务器
安装Git yum install -y git git --version 创建 Git 用户 sudo adduser git // 设置密码 passwd git 导入公钥 find / -na ...
- King's Game---hdu5643(约瑟夫环)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5643 约瑟夫环问题的原来描述为,设有编号为1,2,……,n的n(n>0)个人围成一个圈,从 ...
- 100个常用的linux命令(转)
原文:http://blogread.cn/it/article/6368?f=wb 1,echo “aa” > test.txt 和 echo “bb” >> test.txt / ...
- yarn的使用
yarn 的安装 npm install -g yarn yarn -version 查看yarn是否安装成功 一.首先需要了解的命令 npm install === yarn —— install ...
- (2.6)Mysql之SQL基础——存储引擎的查看与修改
(2.6)Mysql之SQL基础——存储引擎的查看与修改 可以使用 show engines; 查看数据库支持的所有的存储引擎: 目录: 1.数据库级别存储引擎 1.1查看现在默认的存储引擎 1.2 ...
- Docker中安装配置Oracle数据库
本文使用的OS是Ubuntu([16.04.1_server][1])[注:Ubuntu是安装在vmware虚拟机上的]. 其他的Oracle连接工具:[sqldeveloper-4.1.5.21.7 ...
- 003-maven简介
1.1简介 Maven,只是的积累,专家或内行 Maven是优秀的构建工具,依赖管理工具,项目信息管理工具,跨平台.提供了中央仓库,自动下载构件. 1.通过坐标系统定位每一个构件(artifact), ...
- 03 linux命令的操作
开启Linux操作系统,要求以root用户登录GNOME图形界面,语言支持选择为汉语 使用快捷键切换到虚拟终端2,使用普通用户身份登录,查看系统提示符 使用快捷键切换到虚拟终端5,使用管理员身份登录, ...