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. 一.shell基础知识

    参考网站:http://billie66.github.io/TLCL/book/chap08.html 1.字符“*”--展开 [me@linuxbox ~]$ echo * Desktop Doc ...

  2. 七牛云存储--内存put示例(go sdk)

    啥都不说了,居然有文档,有git为啥不提供example? 自己看代码,琢磨了一下,原来是要这么用的.这里不得不吐槽一下package的命名,为啥要去io?golang自带系统包名就有io啊,哥哥. ...

  3. MySQL优化(二):SQL优化

    一.SQL优化 1.优化SQL一般步骤 1.1 查看SQL执行频率 SHOW STATUS LIKE 'Com_%'; Com_select:执行SELECT操作的次数,一次查询累加1.其他类似 以下 ...

  4. 微信对接HIS——微信可查检验结果

    患者仅仅要关注医院官方微信,不管身处何地,输入自己预留在医院的电话号码.检验单的条码号,就能够了解检验结果. 医院信息系统在提供病人数据信息前,会对查询方做身份认证和安全防护检測,录入患者挂号时预留的 ...

  5. 使用selenium找出外卖点餐次数最多的10个顾客

    大锅在做外卖,给我说能否统计出这半年点餐次数最多的10个顾客,我不知道APP本身是否有这个功能,想了下最近用selenium较多,就用selenium尝试下吧. 1 定义一个类,这里先描述需要的属性和 ...

  6. PAT 1122 Hamiltonian Cycle[比较一般]

    1122 Hamiltonian Cycle (25 分) The "Hamilton cycle problem" is to find a simple cycle that ...

  7. jenkins SSH登录 Git配置(通过eclipse生成SSH 密钥)

    1.通过eclipse生成SSH 密钥 菜单栏的windows-->preferences-->General-->Network Connections-->SSH2--&g ...

  8. Part01、sqlalchemy 使用

    一.ORM         连表               一对多               1.创建表,主动指定外键约束.               2.操作.                 ...

  9. C# DataTable Column DataType 对应 数据库

      public DataTable MakeDataTable(){ DataTable myTable; DataRow myNewRow; // Create a new DataTable. ...

  10. POJ 3253 Fence Repair(简单哈弗曼树_水过)

    题目大意:原题链接 锯木板,锯木板的长度就是花费.比如你要锯成长度为8 5 8的木板,最简单的方式是把21的木板割成13,8,花费21,再把13割成5,8,花费13,共计34,当然也可以先割成16,5 ...