1 从菜单选择Other 
Eclipse使用Axis生成WebService客户端的过程
2 选择 【Web Services】 下面的 【Web Service Client】
Eclipse使用Axis生成WebService客户端的过程
3 在【Service definition】里面写上完整的路径
比如 [url]http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?WSDL[/url]
或者CSDN的 OpenAPI
[url]http://forum.csdn.net/OpenApi/forumapi.asmx[/url]
Eclipse使用Axis生成WebService客户端的过程
4 选择路径
Eclipse使用Axis生成WebService客户端的过程
5 完成的结果
Eclipse使用Axis生成WebService客户端的过程

//方式一
        String url = "http://10.4.2.84:81/server.php";
        WeatherWebServiceLocator locator = new WeatherWebServiceLocator();
        WeatherWebServiceSoap hw = new WeatherWebServiceSoap12Stub(new URL(url), locator);
        System.out.println(hw.addUser(1, 2));
       
       
        //方式二
        
        WeatherWebServiceSoapProxy proxy = new WeatherWebServiceSoapProxy();
        System.out.println(proxy.addUser(1, 3));

相关文章: