5

只是我有一个在USPS注册,提供US Address Validation API. 我正在使用以下代码来获取XML Response.

但是,不幸的是,Response说:

授权失败用户 'xxxxxxxxx' 未被授权使用 API Verify.USPSCOM::DoAuth。

我错过了什么吗?

代码:

void IsValidAddress()
{
    string USPS = "http://production.shippingapis.com/ShippingAPITest.dll?API=Verify&XML=<AddressValidateRequest%20USERID='xxxxxxx'><Address ID='1'><Address1></Address1><Address2>8 Wildwood Drive</Address2><City>Old Lyme</City><State>CT</State><Zip5>06371</Zip5><Zip4></Zip4></Address></AddressValidateRequest>";
    WebClient wsClient = new WebClient();

    byte[] responseData = wsClient.DownloadData(USPS);

    string response = string.Empty;

    foreach (byte item in responseData)
    {
        //this will return the xml response
        response += (char)item;
    }
    string result = response;
    Response.Write(result);
}

请参阅:如何在 USPS 上验证地址

注意:User ID是我的个人用户 ID,由 USPS 服务提供商签发。

4

1 回答 1

4

要解决此错误,我们需要致电 USPS 并通过向 USPS 签发注册 ID 来请求验证,并且首先您可以向 USPS 发送邮件作为对此问题的反馈。

于 2014-03-06T04:06:17.667 回答