webservice之获取ip归属地
来源:互联网 发布:美国农业部数据网站 编辑:程序博客网 时间:2024/05/01 14:19
ip地址查询webservice地址:http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?op=getCountryCityByIp
soap请求规则:
POST /WebServices/IpAddressSearchWebService.asmx HTTP/1.1Host: www.webxml.com.cnContent-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: "http://WebXml.com.cn/getCountryCityByIp"请求<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getCountryCityByIp xmlns="http://WebXml.com.cn/"> <theIpAddress>string</theIpAddress> </getCountryCityByIp> </soap:Body></soap:Envelope>HTTP/1.1 200 OKContent-Type: text/xml; charset=utf-8Content-Length: length
响应<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getCountryCityByIpResponse xmlns="http://WebXml.com.cn/"> <getCountryCityByIpResult> <string>string</string> <string>string</string> </getCountryCityByIpResult> </getCountryCityByIpResponse> </soap:Body></soap:Envelope>
代码如下:
private static void getCountryByIp(String ip) {try {String address = "http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx";ServiceClient sender = new ServiceClient();EndpointReference endpointReference = new EndpointReference(address);Options options = new Options();options.setAction("http://WebXml.com.cn/getCountryCityByIp");options.setTo(endpointReference);sender.setOptions(options);OMFactory fac = OMAbstractFactory.getOMFactory();OMNamespace omNs = fac.createOMNamespace("http://WebXml.com.cn/","getCountryCityByIp");OMElement data = fac.createOMElement("getCountryCityByIp", omNs);String[] strs = new String[] { "theIpAddress" };String[] val = new String[] { ip };for (int i = 0; i < strs.length; i++) {OMElement inner = fac.createOMElement(strs[i], omNs);inner.setText(val[i]);data.addChild(inner);}OMElement result = sender.sendReceive(data);System.out.println(result.toString());} catch (AxisFault ex) {ex.printStackTrace();}}
调用getCountryByIp("86.65.152.152");
返回:<getCountryCityByIpResponse xmlns="http://WebXml.com.cn/"><getCountryCityByIpResult><string>86.65.152.152</string><string>法国 </string></getCountryCityByIpResult></getCountryCityByIpResponse>
0 0
- webservice之获取ip归属地
- 获取ip归属地
- webservice获取手机归属地
- flex访问webService获取手机号归属地
- 利用webservice获取所有手机号归属地
- Android 利用 Webservice 获取手机号码归属地
- 访问webservice获取手机号码归属地
- 利用新浪api获取ip归属地
- php实现获取IP地址归属地
- 获取用户ip及归属地
- ip获取归属地位置信息
- 使用WebService实现IP归属地查询源码
- ip归属地免费接口,api,wsdl,webservice
- ip查询归属地
- IP归属地查询
- 判断ip归属地
- 使用WebService 获取网络服务数据(手机归属地)
- soso地图API 获取本机IP归属地
- Linux 系统对 pthreads 提供了良好的支持
- Erlang云中漫步
- ubuntu之rsync服务
- 拍照或本地媒体库获取图片
- 夏日溶溶,阳光带着热忱,
- webservice之获取ip归属地
- pipe row 的用法,Oracle split 函数写法
- scikit-learn的安装
- Maven 手动添加 JAR 包到本地仓库
- linux关机
- cowboy 分析
- SharePoint 页面JS上下文对象 "_spPageContextInfo"
- ACM(011)奇偶数分离(1)
- 陌陌该怎样卸下约炮神器的“美誉”?