Webservice - Demo : Hello + Name (客户端篇)

来源:互联网 发布:yy音效软件下载 编辑:程序博客网 时间:2024/05/20 21:45

Webservice - Demo : Hello + Name (客户端篇)

一、使用 JDK 生成 Webservice - 客户端 代码 (打开cmd,切换到jdk\bin目录下,使用wsimport生成代码)

cd C:\Program Files\Java\jdk1.6.0_45\binwsimport -keep -p com.atguigu.day01_ws.ws http://127.0.0.1:8080/day01_ws/hellows?wsdl

二、写个ClientTest调用下就好了

package com.atguigu.day01_ws_client.test;import com.atguigu.day01_ws.ws.HelloWSImpl;import com.atguigu.day01_ws.ws.HelloWSImplService;/* * 调用webservice */public class ClientTest {public static void main(String[] args) {HelloWSImplService factory = new HelloWSImplService();HelloWSImpl helloWS = factory.getHelloWSImplPort();System.out.println(helloWS.getClass());String result = helloWS.sayHello("Jack");System.out.println("client "+result);}}


0 0
原创粉丝点击