简体   繁体   English

FEDEX Web Services wsdl文件

[英]FEDEX Web Services wsdl file

I have been asked to integrate a website with FedEx using PHP. 我被要求使用PHP将网站与FedEx集成。 I have no idea where to start. 我不知道从哪里开始。 I have signed up for a test account and I have downloaded the only example code there is. 我已经注册了一个测试帐户,我已经下载了唯一的示例代码。 This references a .wsdl file but the sample code does not actually include the file. 这引用了.wsdl文件,但示例代码实际上不包含该文件。 I cannot find anywhere in the documentation where to get this file. 我在文档中的任何地方都找不到这个文件的位置。 Can anyone help? 有人可以帮忙吗? If I could get a connection to the API sometime this week I will be happy. 如果我能在本周的某个时候获得与API的连接,我会很高兴。

// Copyright 2009, FedEx Corporation. All rights reserved.
// Version 2.0.0

require_once('../library/fedex-common.php5');


//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "../wsdl/LocatorService_v2.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('UserCredential' =>
                                                      array('Key' => getProperty('key'), 'Password' => getProperty('password')));
$request['ClientDetail'] = array('AccountNumber' => getProperty('shipaccount'), 'MeterNumber' => getProperty('meter'));
$request['TransactionDetail'] = array('CustomerTransactionId' => '*** Locator Request v2 using PHP ***');
$request['Version'] = array('ServiceId' => 'dloc', 'Major' => '2', 'Intermediate' => '0', 'Minor' => '0');

$bNearToPhoneNumber = false;
if ($bNearToPhoneNumber)
{
    $request['NearToPhoneNumber'] = getProperty('phonenumber'); // Replace 'XXX' with phone number
}
else
{
    $request['NearToAddress'] = getProperty('locatoraddress');
}

$request['DropoffServicesDesired'] = array('Express' => 1, // Location desired services
                                                                    'FedExStaffed' => 1,
                                                                    'FedExSelfService' => 1,
                                                                    'FedExAuthorizedShippingCenter' => 1,
                                                                    'HoldAtLocation' => 1);

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

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

    if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
    {
        echo 'Dropoff Locations<br>';
        echo '<table border="1"><tr><td>Streetline</td><td>City</td><td>State</td><td>Postal Code</td><td>Distance</td></tr>';
        foreach ($response -> DropoffLocations as $location)
        {
            if(is_array($response -> DropoffLocations))
            {              
                echo '<tr>';
                echo '<td>'.$location -> BusinessAddress -> StreetLines. '</td>';
                echo '<td>'.$location -> BusinessAddress -> City. '</td>';
                echo '<td>'.$location -> BusinessAddress -> StateOrProvinceCode. '</td>';
                echo '<td>'.$location -> BusinessAddress -> PostalCode. '</td>';
                echo '<td>('.$location -> Distance -> Value . ' ';
                echo $location -> Distance -> Units . ')'. '</td>';
                echo '</tr>';
            }
            else
            {
                //echo $location . Newline;
            }
        }
        echo '</table>';
        printSuccess($client, $response);
    }
    else
    {
        printError($client, $response);
    } 

    writeToLog($client);    // Write to log file   

} catch (SoapFault $exception) {
    printFault($exception, $client);
}

?>

This may be your wsdl: https://github.com/timborden/fedex/blob/master/wsdl/LocatorService_v2.wsdl 这可能是你的wsdl: https//github.com/timborden/fedex/blob/master/wsdl/LocatorService_v2.wsdl

But you should have a more official download link on the Fedex Documentation. 但是你应该在Fedex文档上有一个更正式的下载链接。

The code example is not that good btw, ini_set("soap.wsdl_cache_enabled", "0"); 代码示例不是那么好btw,ini_set(“soap.wsdl_cache_enabled”,“0”); should be remove (performance issues) but at least there is a PHP client (fedex-common)! 应该删除(性能问题),但至少有一个PHP客户端(fedex-common)!

Login to FedEx then go here: https://www.fedex.com/wpor/web/jsp/drclinks.jsp?links=wss/getstarted.html 登录FedEx然后转到此处: https//www.fedex.com/wpor/web/jsp/drclinks.jsp?links = wss / getstarted.html

Select PHP in the Rate row and select Include documentation . Rate行中选择PHP ,然后选择Include documentation You will get prompted to save 2 zip files, one of which is the WSDL. 系统将提示您保存2个zip文件,其中一个是WSDL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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