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、运行客户端,看是否成功


最新文章

  1. mysql源码包手动安装、配置以及测试(亲测可行)
  2. 敏捷开发XP
  3. C#加密解密(DES,AES,Base64,md5,SHA256,RSA,RC4)
  4. MVVM了解
  5. Android 5中不同效果的Toast
  6. android button minheight问题
  7. 零售业数据分析的媒介——BI工具
  8. nat模式、路由模式,网桥模式
  9. 不熟悉的CSS样式
  10. Storm流计算从入门到精通之技术篇(高并发策略、批处理事务、Trident精解、运维监控、企业场景)
  11. sodu 命令场景分析
  12. tomcat中的线程问题2
  13. 【国庆】记一次mysqld_safe引发mysql进程故障
  14. golang实现的简单优先队列
  15. C++版 - 剑指offer 面试题5:从尾到头打印链表 题解
  16. META-INF文件夹中的MANIFEST.MF 的作用
  17. 学习笔记之PostgreSQL / pgAdmin / Psycopg / PostGIS
  18. 请求(Request)的参数(Param)里包含特殊字符(#等)的正确处理方式
  19. JETTY+NGINX
  20. ubuntu 14.04 安装 gflags

热门文章

  1. navicat导入数据出现中文乱码
  2. About LabView
  3. Yii2的主从数据库设置
  4. Android设置透明状态栏和透明导航栏
  5. lua相关库安装常见问题
  6. python常见模块之os模块
  7. maven之jre默认配置
  8. mongoDb,下载及启动
  9. R语言 dbWriteTable 写入数据库 为空和乱码问题
  10. 理解tomcat之搭建简易http服务器