简体   繁体   中英

Fedex Web Services: ERROR 9040 - Can't pull up tracking

I'm having issues attempting to pull up tracking info using Fedex's Web Services. I am using a valid tracking number and I'm able to view the details on Fedex's site. However, I get an error 9040 "No information for the following shipments has been received by our system yet. Please try again or contact Customer Service at 1.800.Go.FedEx(R) 800.463.3339." Am I leaving something out?

My code:

<?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);


?>

Got it!

Call the web services departement and they told me to remove 'beta' from the wsdl file. This appears to be a different address than what I found in responses to this problem before. On line 1507 of the wsdl file, make the following change:

From:

<s1:address location="https://wsbeta.fedex.com:443/web-services/track"/>

To

<s1:address location="https://ws.fedex.com:443/web-services/track"/>

I changed the rest of my code slightly, but that shouldn't have made the difference. To be on the safe side, here it is:

<?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);

?>

I'm also working on this same problem. I'm trying several things and you can see if anything works for you. Try including ShipDateRangeBegin and End elements, your test account/payer numbers or destination info. I've found here that switching to xml and ssl post requests supposedly solve the problem, but it's not an option for me. Maybe it will help you?

I have same problem when use xml-request. I solved the problem this way:

$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);
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM