1. 程式人生 > >java調用c#開發的webservice

java調用c#開發的webservice

bool verbose int exceptio web rgs 目錄 odi 自帶

使用jdk自帶的wsimport工具生成代理類

c:\Program Files\Java\jdk1.8.0_121\bin>wsimport -keep -encoding utf-8 -d d:\ -s d:\src -verbose http://192.168.61.193/WeatherWebServiceJTB/WebService_Out.asmx?WSDL

-keep 保留生成的文件

-d 指定輸出文件的目錄

-s 輸出源文件的目錄

-verbose 顯示過程輸出

調用例子

    public static void main(String[] args) throws
Exception { String strUrl = "http://192.168.61.193/WebService/WeatherService_Out.asmx"; URL url = new URL(strUrl); WeatherService service = new WeatherService(url); WeatherServiceSoap client = service.getWeatherServiceSoap();
boolean b = client.testConnection(); String strVer = client.getCurrentVer(); System.out.println(strVer); }

java調用c#開發的webservice