0
UPS的服務器一直給我這樣的響應:UPS API使用捲曲和PHP ...格式良好的XML問題
HTTP/1.1 200 OK
Server: Apache
Content-Length: 429
X-Powered-By: Servlet/2.5 JSP/2.1
Content-Type: application/xml
Expires: Wed, 31 Aug 2011 21:28:12 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
Date: Wed, 31 Aug 2011 21:28:12 GMT
Connection: keep-alive
與此錯誤:
<AddressValidationResponse>
<Response>
<TransactionReference>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<ResponseStatusCode>0</ResponseStatusCode>
<ResponseStatusDescription>Failure</ResponseStatusDescription>
<Error>
<ErrorSeverity>Hard</ErrorSeverity>
<ErrorCode>10001</ErrorCode>
<ErrorDescription>The XML document is not well formed</ErrorDescription>
</Error>
</Response>
</AddressValidationResponse>
這裏是PHP代碼中,我正在發送到服務器。是否有錯誤,我錯過了,忽略?
$data = '<?xml version=\"1.0\" ?>
<AccessRequest xml:lang=\"en-US\">
<AccessLicenseNumber>$this->AccessLicenseNumber</AccessLicenseNumber>
<UserId>$this->UserId</UserId>
<Password>$this->Password</Password>
</AccessRequest>
<?xml version=\"1.0\" ?>
<AddressValidationRequest xml:lang=\"en-US\">
<Request>
<TransactionReference>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<RequestAction>XAV</RequestAction>
<RequestOption>3</RequestOption>
</Request>
<AddressKeyFormat>
<AddressLine>$address</AddressLine>
<PoliticalDivision2>$city</PoliticalDivision2>
<PoliticalDivision1>$state</PoliticalDivision1>
<PostcodePrimaryLow>$zip</PostcodePrimaryLow>
<CountryCode>US</CountryCode>
</AddressKeyFormat>
</AddressValidationRequest>';
任何幫助將不勝感激。謝謝。
阿內替代變量!對我而言,這是多麼可怕的疏忽!這擺脫了我的錯誤10001 ...但現在我收到位於AccessRequest/UserId的錯誤10002。 –
確保設置了'$ this-> UserId'(也許只是$ UserId ?!)。 – stewe