Php 联邦快递Web服务wsdl文件

Php 联邦快递Web服务wsdl文件,php,web-services,api,wsdl,fedex,Php,Web Services,Api,Wsdl,Fedex,我被要求使用PHP与联邦快递集成一个网站。我不知道从哪里开始。我已经注册了一个测试帐户,并且下载了唯一的示例代码。这引用了一个.wsdl文件,但示例代码实际上并不包含该文件。我在文档中找不到任何地方可以获取此文件。有人能帮忙吗?如果我能在本周的某个时候连接到API,我会很高兴的 // Copyright 2009, FedEx Corporation. All rights reserved. // Version 2.0.0 require_once('../library/fedex-co

我被要求使用PHP与联邦快递集成一个网站。我不知道从哪里开始。我已经注册了一个测试帐户,并且下载了唯一的示例代码。这引用了一个.wsdl文件,但示例代码实际上并不包含该文件。我在文档中找不到任何地方可以获取此文件。有人能帮忙吗?如果我能在本周的某个时候连接到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);
}

?>
//版权所有2009,联邦快递公司。版权所有。
//版本2.0.0
需要一次('../library/fedex common.php5');
//示例代码中不包含WSDL。
//请在$path_to_wsdl变量中包含和引用。
$path_to_wsdl=“../wsdl/LocatorService_v2.wsdl”;
ini_集(“soap.wsdl_缓存已启用”,“0”);
$client=newsoapclient($path_to_wsdl,array('trace'=>1));//提到http://us3.php.net/manual/en/ref.soap.php 更多信息
$request['WebAuthenticationDetail']=数组('UserCredential'=>
数组('Key'=>getProperty('Key'),'Password'=>getProperty('Password'));
$request['ClientDetail']=array('AccountNumber'=>getProperty('shipaccount'),'MeterNumber'=>getProperty('meter');
$request['TransactionDetail']=array('CustomerTransactionId'=>'***使用PHP***'的定位器请求v2);
$request['Version']=array('ServiceId'=>'dloc','Major'=>'2','mediate'=>'0','Minor'=>'0');
$bNearToPhoneNumber=false;
如果($bNearToPhoneNumber)
{
$request['NearToPhoneNumber']=getProperty('phonenumber');//将'XXX'替换为电话号码
}
其他的
{
$request['NearToAddress']=getProperty('locatoraddress');
}
$request['dropOfficesDesired']=array('Express'=>1,//位置所需服务
“FedexTaffed”=>1,
“联邦快递自助服务”=>1,
“FedExAuthorizedShippingCenter”=>1,
“保持位置”=>1);
尝试
{
if(setEndpoint('changeEndpoint'))
{
$newLocation=$client->_setLocation(setEndpoint('endpoint'));
}
$response=$client->fedExLocator($request);
如果($response->HighestSeverity!=“FAILURE”&&$response->HighestSeverity!=“ERROR”)
{
回声“衰减位置
”; echo“StreetlineCityStatePostalCodeDistance”; foreach($response->DropoffLocations as$location) { if(是_数组($response->DropoffLocations)) { 回声'; 回声“.$location->BusinessAddress->StreetLines.”; 回显“.$location->BusinessAddress->City.”; 回显“.$location->BusinessAddress->StateOrProvinceCode.”; 回显“.$location->BusinessAddress->PostalCode.”; 回显“(“$location->Distance->Value.”; echo$位置->距离->单位。“)”; 回声'; } 其他的 { //echo$location.Newline; } } 回声'; printSuccess($client$response); } 其他的 { 打印错误($client$response); } writeToLog($client);//写入日志文件 }catch(SoapFault$异常){ printFault($exception,$client); } ?>
这可能是您的wsdl:

但是你应该在联邦快递文件上有一个更正式的下载链接


代码示例不是很好,顺便说一句,ini_集(“soap.wsdl_缓存已启用”,“0”);应该删除(性能问题),但至少有一个PHP客户端(联邦快递通用)

登录联邦快递,然后转到此处:


比率行中选择PHP,然后选择包含文档。系统将提示您保存2个zip文件,其中一个是WSDL。

FYI:github repo已被删除。WSDLs可以在这里找到:新的Kohana模块可以在这里找到:(没有WSDLs)检查“全部下载”选项旁边的包含文档是我找到实际WSDLs的唯一方法现在url是: