国家、州、省 WebService? [英] Country, State, Province WebService?

查看:34
本文介绍了国家、州、省 WebService?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何很好的网络服务可以为国家和州/省提供良好的查找信息?

Are there any good webservices out there that provide good lookup information for Countries and States/Provinces?

如果有,你用什么?

推荐答案

如果您只需要美国信息,US Postal Service 提供了一组 Web 服务,它为此调用了 WebTools.https://www.usps.com/business/web-tools-apis/welcome.htm.您需要注册才能使用它们,但一旦注册,它们就非常易于使用.您只需通过 HTTP 发送一个 XML 请求,服务器将返回一个 XML 响应,您只需解压缩它.

If you only need US information, the US Postal Service provides a set of web services it calls WebTools for this exact thing. https://www.usps.com/business/web-tools-apis/welcome.htm. You will need to register to be able to use them but once you're registered they are really simple to use. You just send an XML request over HTTP and the server sends an XML response back and you just have to unpack it.

示例请求:

http://SERVERNAME/ShippingAPITest.dll?API=Verify&XML=<AddressValidateRequest%20USERID="xxxxxxx"><Address ID="0"><Address1></Address1><Address2>6406 Ivy Lane</Address2><City>Greenbelt</City><State>MD</State><Zip5></Zip5><Zip4></Zip4></Address></AddressValidateRequest>

示例响应:

<?xml version="1.0"?>
<AddressValidateResponse>
     <Address ID="0">
         <Address2>6406 IVY LN</Address2>
         <City>GREENBELT</City>
         <State>MD</State>
         <Zip5>20770</Zip5>
         <Zip4>1441</Zip4>
     </Address>
</AddressValidateResponse>

这是技术文档的链接:https://www.usps.com/business/web-工具-apis/documentation-updates.htm

这篇关于国家、州、省 WebService?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆