0
私は、使用されたサービスタイプに基づいて、予想される配送時間を返すために、fedex serviceavailabiltyを統合しようとしています。fedex serviceavailabilityrequestが失敗しています
私はcurlを使用してHTTPポスト経由でxmlを使用していますが、エラーが発生しています。
<SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring xml:lang="en">Fault</faultstring>
<detail>
<cause>Transient</cause>
<code>unknownCode</code>
<desc>java.lang.NullPointerException</desc>
</detail>
</SOAP-ENV:Fault
私のコードは次のとおりです。
$request = "<?xml version=\"1.0\"?>
<ns:ServiceAvailabilityRequest xmlns:ns=\"http://fedex.com/ws/vacs/v4\">
<ns:WebAuthenticationDetail>
<ns:UserCredential>
<ns:Key>{$this->apikey}</ns:Key>
<ns:Password>{$this->password}</ns:Password>
</ns:UserCredential>
</ns:WebAuthenticationDetail>
<ns:ClientDetail>
<ns:AccountNumber>{$this->account}</ns:AccountNumber>
<ns:MeterNumber>{$this->meter}</ns:MeterNumber>
</ns:ClientDetail>
<ns:TransactionDetail>
<ns:CustomerTransactionId>ServiceAvailabilityRequest</ns:CustomerTransactionId>
</ns:TransactionDetail>
<ns:Version>
<ns:ServiceId>trck</ns:ServiceId>
<ns:Major>4</ns:Major>
<ns:Intermediate>0</ns:Intermediate>
<ns:Minor>0</ns:Minor>
</ns:Version>
<ns:Origin>
<ns:PostalCode>07075</ns:PostalCode>
<ns:CountryCode>US</ns:CountryCode>
</ns:Origin>
<ns:Destination>
<ns:PostalCode>11216</ns:PostalCode>
<ns:CountryCode>US</ns:CountryCode>
</ns:Destination>
<ns:ShipDate>2017-07-08</ns:ShipDate>
<ns:CarrierCode>FDXE</ns:CarrierCode>
</ns:ServiceAvailabilityRequest>";
$ch = curl_init('http://gateway.fedex.com:443/xml');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
すべてのヘルプは高く評価されます。
は、あなたが受けているエラーは一時的なものであるようですが、それはフェデックス側の問題になる可能性があり、おそらく自分自身を解決することを意味しているに見えるあなたに
リック
ありがとうsanbornm。私はserviceIdを 'vacs'に修正しました。それは魅力的に機能しました。 – Rick