调用手机归属地的Web Service
i.创建项目
项目名称:phoneclient
ii.创建本地的wsdl文件
文件名称:phone.wsdl
访问:http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl会看到文件,然后查看源码
保存到本地。
iii.根据本地的wsdl文件生成调用服务端的代码
使用wsimport -target 2.0 -keep 本地wsdl文件路径
iv.调用
包名:cn.com.webxml.client
类名:PhonePlaceTest.java
类内容:
public class PhonePlaceTest {
public static void main(String[] args) {
MobileCodeWS mcws = new MobileCodeWS();
MobileCodeWSSoap mobileCodeWSSoap = mcws.getMobileCodeWSSoap();
String result = mobileCodeWSSoap.getMobileCodeInfo("18612229303", null);
System.out.println(result);
}
}
转载于:https://blog.51cto.com/suyanzhu/1564335