请求过程分析:
1.使用get方式获取wsdl文件,称为握手
2.使用post发出请求
3.服务器响应成功
几种监听工具:
http watch
Web Service explorer
eclipse 自带工具 TCP/IP Monitor
一.客户端调用(wximport自动生成代码 【推荐】)
1 public class App { 2 /** 3 * 通过wsimport 解析wsdl生成客户端代码调用WebService服务 4 * @param args 5 */ 6 public static void main(String[] args) { 7 /** 8 * <service name="MyService"> 9 * 获得服务名称 10 */ 11 MyService mywebService = new MyService(); 12 /** 13 * <port name="HelloServicePort" binding="tns:HelloServicePortBinding"> 14 */ 15 HelloService hs = mywebService.getHelloServicePort(); 16 /** 17 * 调用方法 18 */ 19 System.out.println(hs.sayGoodbye("sjk")); 20 System.out.println(hs.aliassayHello("sjk")); 21 } 22 }