php – Fedex Web Services:ERROR 9040 – 无法启动跟踪
作者:互联网
我在尝试使用Fedex的Web服务提取跟踪信息时遇到问题.我使用的是有效的跟踪号码,我可以在Fedex的网站上查看详细信息.但是,我收到错误9040“我们的系统尚未收到以下货件的信息.请重试或联系客户服务部1.800.Go.FedEx(R)800.463.3339.”我要留下什么了?
我的代码:
<?php
$path_to_wsdl = "URL_TO_WSDL";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1));
$request['WebAuthenticationDetail'] = array(
'UserCredential' =>array(
'Key' => 'MY_KEY',
'Password' => 'MY_PASSWORD'
)
);
$request['ClientDetail'] = array(
'AccountNumber' => 'MY_ACCT',
'MeterNumber' => 'MY_METER'
);
$request['TransactionDetail'] = array('CustomerTransactionId' => 'ActiveShipping');
$request['Version'] = array(
'ServiceId' => 'trck',
'Major' => '5',
'Intermediate' => '0',
'Minor' => '0'
);
$request['PackageIdentifier'] = array(
'Value' => 'TRACKING#',
'Type' => 'TRACKING_NUMBER_OR_DOORTAG');
$response = $client->track($request);
var_dump($response);
?>
解决方法:
得到它了!
打电话给Web服务部门,他们告诉我从wsdl文件中删除“beta”.这似乎与我之前在回答此问题时发现的地址不同.在wsdl文件的第1507行,进行以下更改:
从:
<s1:address location="https://wsbeta.fedex.com:443/web-services/track"/>
至
<s1:address location="https://ws.fedex.com:443/web-services/track"/>
我稍微更改了其余的代码,但这不应该有所不同.为了安全起见,这里是:
<?php
$path_to_wsdl = "PATH_TO_WSDL_FILE";
$client = new SoapClient($path_to_wsdl, array('trace' => 1));
$trackRequest = array(
'WebAuthenticationDetail' => array(
'UserCredential' => array(
'Key' => 'MY_KEY',
'Password' => 'MY_PASSWORD'
)
),
'ClientDetail' => array(
'AccountNumber' => 'MY_ACCT_#',
'MeterNumber' => 'MY_METER_#'
),
'Version' => array(
'ServiceId' => 'trck',
'Major' => '5',
'Intermediate' => '0',
'Minor' => '0'
),
'PackageIdentifier' => array(
'Type' => 'TRACKING_NUMBER_OR_DOORTAG',
'Value' => 'THE_TRACKING_#',
),
'CustomerTrasactionId',
'IncludeDetailedScans' => 1
);
$response = $client->track($trackRequest);
var_dump($response);
?>
标签:php,soap,fedex 来源: https://codeday.me/bug/20190630/1333289.html