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整合客户端开发的更多相关文章

  1. 【WebService】WebService之CXF和Spring整合(六)

    前面介绍了WebService与CXF的使用,项目中我们经常用到Spring,这里介绍CXF与Spring整合 步骤 1.创建一个Maven Web项目,可以参照:[Maven]Eclipse 使用M ...

  2. webservice的cxf和spring整合发布

    1.新建一个web项目 2.导入cxf相应的jar包,并部署到项目中 3.服务接口 package com.xiaostudy; /** * @desc 服务器接口 * @author xiaostu ...

  3. Java WebService 教程系列之 Spring 整合 CXF

    Java WebService 教程系列之 Spring 整合 CXF 一.引入 jar 包 <dependency> <groupId>org.apache.cxf</ ...

  4. 浅谈WebService之JAX-RS与spring整合

    背景:首先谈一下webservice: 1.Web service是一个平台独立的,低耦合的,自包含的.基于可编程的web的应用程序, 可使用开放的XML(标准通用标记语言下的一个子集)标准来描述.发 ...

  5. CXF和spring整合遇到的问题:No bean named 'cxf' is defined

    今天在做ws和spring整合的时候,很不幸的遇到了这个问题,百度了好久,竟然没人遇到这个问题,后来谷歌了一下,都是遇到这个问题的了...在看到一篇文章中提到了cxf.xml,所以我果断的打开这个配置 ...

  6. Spring整合web开发

    正常整合Servlet和Spring没有问题的 public class UserServlet extends HttpServlet { public void doGet(HttpServlet ...

  7. 随便聊聊 SOA & SOAP & WebService 的一些东西,以及客户端开发的代码逻辑解析

    http://blog.csdn.net/hikaliv/article/details/6459779 一天的时间调通了一个 WebService 的 Java 端的 C/S.一个 Android  ...

  8. WS之cxf与spring整合1

    1.在web.xml中加入CXFServlet: <!-- 下面表示所有来自/cxfservice/*的请求,都交给 CXFServlet来处理 .--> <servlet>  ...

  9. CXF、Spring整合的SOAP Web Service服务端

    1.建工程,导入CXFjar包 2.服务接口 package com.cxf.soap; import java.util.List; import javax.jws.WebService; @We ...

随机推荐

  1. Linux之Redis-redis哨兵集群详解

    1.Sentinel 哨兵 Sentinel(哨兵)是Redis 的高可用性解决方案:由一个或多个Sentinel 实例 组成的Sentinel 系统可以监视任意多个主服务器,以及这些主服务器属下的所 ...

  2. python包管理一防丢失

    pip3 freeze >list.txt      导出当前环境安装的所有包(list是当前项目录下的文件,可以自己命名)pip3 install -r list.txt     安装文件中所 ...

  3. 增强MyEclipse的代码自动提示功能

      一般在Eclipse ,MyEclipse代码里面,打个foreach,switch等 这些,是无法得到代码提示的(不信自己试试),其他的就更不用说了,而在Microsoft Visual Stu ...

  4. 0603-Zuul构建API Gateway-通过Zuul上传文件,禁用Zuul的Filter

    一.通过Zuul上传文件 参看地址:https://cloud.spring.io/spring-cloud-static/Edgware.SR3/single/spring-cloud.html#_ ...

  5. Python np.newaxis

    np.newaxis的功能是插入新维度,看下面的例子: a=np.array([1,2,3,4,5])print a.shape print a 输出结果 (5,)[1 2 3 4 5] 可以看出a是 ...

  6. PAT 1130 Infix Expression[难][dfs]

    1130 Infix Expression (25 分) Given a syntax tree (binary), you are supposed to output the correspond ...

  7. mac shell

    查看所有shell:cat /etc/shells 查看当前正在使用的shell:echo $SHELL 切换shell:chsh -s /bin/zsh

  8. python之路 django2

    Django请求生命周期 首先:对于所有的web框架来说本质就是一个socket服务端,浏览器是socket客户端 路由系统 在Django的urls中我们可以根据一个URL对应一个函数名来定义路由规 ...

  9. centos7 离线安装docker-ce

    测试的时候,在VM中安装了一个minimal安装的centos7.因为发现在已经安装好环境的系统中,执行下面,并不会下载依赖的rpm.#下载docker-ce和其需要的依赖rpm yum instal ...

  10. Docker+.Net Core 的那些事儿-2.创建Docker镜像

    1.从store.docker.com获取.net core镜像 docker pull microsoft/dotnet 2.创建一个.net core项目,并发布 在上篇文章结尾建立的工作目录下, ...