wsimport -d d: -keep -extension -p com.demo.client http://192.168.33.3//RECEPTIONws.ASMX?WSDL
客户端:在JDK的bin文件夹中,有一个wsimport.exe,这个工具依据wsdl文件生成相应的类文件,然后用这些类文件,就可以像调用本地的类一样调用WebService提供的方。该工具可以用于非Java的服务器,如:用C#编写的WebService,通过wsimport则生成Java的客户端实现。
在命令提示符中使用如下命令:wsimport -keep -p com.demo.client http://localhost:8080/Demo/services/MyService?wsdl
1 package com.demo.wsimport; 2 3 public class Test { 4 5 /** 6 * @param args 7 */ 8 public static void main(String[] args) { 9 // TODO Auto-generated method stub 10 MyService server = new MyService(); 11 MyServicePortType spt = server.getMyServiceHttpPort(); 12 System.out.println(spt.example("hello")); 13 } 14 }
客户端:在JDK的bin文件夹中,有一个wsimport.exe,这个工具依据wsdl文件生成相应的类文件,然后用这些类文件,就可以像调用本地的类一样调用WebService提供的方。该工具可以用于非Java的服务器,如:用C#编写的WebService,通过wsimport则生成Java的客户端实现。
在命令提示符中使用如下命令:wsimport -keep -p com.demo.client http://localhost:8080/Demo/services/MyService?wsdl
1 package com.demo.wsimport; 2 3 public class Test { 4 5 /** 6 * @param args 7 */ 8 public static void main(String[] args) { 9 // TODO Auto-generated method stub10 MyService server = new MyService(); 11 MyServicePortType spt = server.getMyServiceHttpPort(); 12 System.out.println(spt.example("hello")); 13 } 14 }