无法从他们的代码中获得联邦快递跟踪ID状态的响应

时间:2018-11-21 06:17:20

标签: tracking fedex

我正在尝试从我从Fedex开发人员部分获得的代码示例中获取fededx跟踪ID的状态,但是无法获取所需的跟踪ID状态信息。我需要这方面的帮助  我是新手。请帮助获取联邦快递跟踪ID状态的响应。

我正在执行的文件=> TrackWebServiceClient.php 执行此文件时,我收到一个错误,我已经提到 下面:     ---------------------------     PHP_Common初始化     故障

Code:HTTP
String:Unable to parse URL  
--------------------------
TrackWebServiceClient.php file code given below =>
<?php
// Copyright 2009, FedEx Corporation. All rights reserved.
// Version 6.0.0

require_once('fedex-common.php');

//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "TrackService_v16.wsdl";

ini_set("soap.wsdl_cache_enabled", "0");

$client = new SoapClient($path_to_wsdl, array('trace' => 1)); // Refer 
to http://us3.php.net/manual/en/ref.soap.php for more information


$request['WebAuthenticationDetail'] = array(

        'ParentCredential' => array(
        'Key' => getProperty('parentkey'), 
        'Password' => getProperty('parentpassword')
    ),  
        'UserCredential' => array(
        'Key' => getProperty('key'), 
        'Password' => getProperty('password')
    )
);

    $request['ClientDetail'] = array(
    'AccountNumber' => getProperty('shipaccount'), 
    'MeterNumber' => getProperty('meter')
    );
    $request['TransactionDetail'] = array('CustomerTransactionId' => '*** 
    Track Request using PHP ***');
    $request['Version'] = array(
    'ServiceId' => 'trck', 
    'Major' => '16', 
    'Intermediate' => '0', 
    'Minor' => '0'
    );
    $request['SelectionDetails'] = array(
    'PackageIdentifier' => array(
        'Type' => 'TRACKING_NUMBER_OR_DOORTAG',
        'Value' => '781193603730' //getProperty('trackingnumber') // 
     Replace 'XXX' with a valid tracking identifier
        )
    );



    try {
        if(setEndpoint('changeEndpoint')){
            $newLocation = $client-
    >__setLocation(setEndpoint('endpoint'));
    }

    $response = $client ->track($request);

        if ($response -> HighestSeverity != 'FAILURE' && $response -> 
 HighestSeverity != 'ERROR'){
        if($response->HighestSeverity != 'SUCCESS'){
            echo '<table border="1">';
            echo '<tr><th>Track Reply</th><th>&nbsp;</th></tr>';
            trackDetails($response->Notifications, '');
            echo '</table>';
        }else{
            if ($response->CompletedTrackDetails->HighestSeverity != 
'SUCCESS'){
                echo '<table border="1">';
                echo '<tr><th>Shipment Level Tracking Details</th>
 <th>&nbsp;</th></tr>';
                trackDetails($response->CompletedTrackDetails, '');
                echo '</table>';
            }else{
                echo '<table border="1">';
                echo '<tr><th>Package Level Tracking Details</th>
<th>&nbsp;</th></tr>';
                 trackDetails($response->CompletedTrackDetails-
>TrackDetails, '');
                echo '</table>';
                }
            }
            printSuccess($client, $response);
        }else{
            printError($client, $response);
        } 

        writeToLog($client);    // Write to log file   
    } catch (SoapFault $exception) {
         printFault($exception, $client);
    }
    ?>

1 个答案:

答案 0 :(得分:0)

我找到了解决方案。它现在正在工作。我错过了在fedex-common.php文件中定义端点的方法,在为它提供了正确的端点之后,它可以正常工作。