如何解决使用 XML 和 Javascript 的 USPS 地址验证 API
const xhttp = new XMLHttpRequest();
const url = 'https://secure.shippingapis.com/ShippingAPI.dll?API=Verify';
xhttp.open('GET',url,true);
xhttp.onreadystatechange = (e) => {
if (xhttp.readyState == 4 && xhttp.status == 200) {
console.log('request successful');
console.log(xhttp.responseXML);
}
}
let xml = '<AddressValidateRequest USERID="XXXXXXXXXXXX"><Address><Address1>324 Church St</Address1><Address2></Address2><City>Ray</City><State>ND</State><Zip5>58849</Zip5><Zip4></Zip4></Address></AddressValidateRequest>'
xhttp.send(xml);
这是回复:
<Error>
<Number>80040B19</Number>
<Description>XML Syntax Error: Please check the XML request to see if it can be parsed.</Description>
<Source>uspsCOM::DoAuth</Source>
</Error>
我不确定我做错了什么。我的 XML 是否正确?我发送正确吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。