Authorization failure in USPS Address verification API

泄露秘密 提交于 2020-01-14 12:38:31

问题


Just i have a Registered with USPS which provides the US Address Validation API. I am using the following code to get the XML Response.

But, unfortunately the Response says:

Authorization Failure User 'xxxxxxxxx' is not authorized to use API Verify.USPSCOM::DoAuth.

Do i missing something?

Code:

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);
}

Please see: How to Validate Address on USPS

Note: the User ID is my personal User ID that is issued by USPS Service Provider.


回答1:


To Resolve this error we need to call the USPS and ask for Verification by issuing the Registered ID with USPS and also first you can send Mail to USPS as a Feedback for this issue.



来源:https://stackoverflow.com/questions/20395069/authorization-failure-in-usps-address-verification-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!