Fedex Web Services:ERROR 9040 - 无法启动跟踪

时间:2012-06-07 00:49:03

标签: php soap fedex

我在尝试使用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);


?>

3 个答案:

答案 0 :(得分:3)

知道了!

致电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);

?>

答案 1 :(得分:0)

我也在研究同样的问题。我正在尝试几件事,你可以看看是否有什么对你有用。尝试包括ShipDateRangeBegin和End元素,您的测试帐户/付款人号码或目的地信息。我发现here切换到xml和ssl发布请求可能会解决问题,但它不适合我。也许它会对你有所帮助?

答案 2 :(得分:0)

使用xml-request时遇到同样的问题。我用这种方式解决了这个问题:

$endpointurl = "https://gatewaybeta.fedex.com:443/xml"; // remove word "beta"
$endpointurl = "https://gateway.fedex.com:443/xml";

...
$request = stream_context_create($form);
$browser = fopen($endpointurl , 'rb' , false , $request);
$response = stream_get_contents($browser);
...