81,092
社区成员
发帖
与我相关
我的任务
分享
public String getCountryCityByIp(String ip) {
String connectPoint = "http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx";
Service srvcModel = new ObjectServiceFactory()
.create(IpAddressSearchWebService.class);
XFireProxyFactory factory = new XFireProxyFactory();
IpAddressSearchWebService srvc;
try {
srvc = (IpAddressSearchWebService) factory.create(srvcModel,
connectPoint);
XFireProxy proxy = (XFireProxy) Proxy.getInvocationHandler(srvc);
Client client = proxy.getClient();
//client.setProperty("SOAPAction", "http://WebXml.com.cn/getVersionTime");
client.setProperty("SOAPAction", "http://WebXml.com.cn/getCountryCityByIp");
String ipDetail = srvc.getCountryCityByIp(ip);
System.out.println(ipDetail);
} catch (MalformedURLException e) {
e.printStackTrace();
}
return null;
}