Fedex API - 身份验证仅适用于创建运输标签

时间:2015-11-09 17:46:42

标签: php api soap fedex

完成了fedex API的开发,我正在尝试切换到生产。

我使用以下常量作为我的凭证:

FEDEX_KEY // The fedex production key
FEDEX_PASSWORD // The api passwd
FEDEX_ACCOUNT_NUMBER // The account number tied to the key/pw
FEDEX_METER_NUMBER // The meter number tied to the key/pw

如“转向生产”中所述,我已从所有.wsdl文件中删除了“beta”属性。

我正在对运输成本进行实时估算,告诉我我的凭据正在正确阅读。

问题是创建货件标签不起作用,它给我以下错误:

The transaction returned an Error.
Severity: ERROR
Source: prof
Code: 1000
Message: Authentication Failed

Request
//Hiding this due to containing private information
Response
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><v17:ProcessShipmentReply xmlns:v17="http://fedex.com/ws/ship/v17"> <v17:HighestSeverity xmlns:v17="http://fedex.com/ws/ship/v17">ERROR</v17:HighestSeverity>  <v17:Notifications xmlns:v17="http://fedex.com/ws/ship/v17">     <v17:Severity xmlns:v17="http://fedex.com/ws/ship/v17">ERROR</v17:Severity>     <v17:Source xmlns:v17="http://fedex.com/ws/ship/v17">prof</v17:Source>     <v17:Code xmlns:v17="http://fedex.com/ws/ship/v17">1000</v17:Code>     <v17:Message xmlns:v17="http://fedex.com/ws/ship/v17">Authentication Failed</v17:Message>  </v17:Notifications> <v17:TransactionDetail xmlns:v17="http://fedex.com/ws/ship/v17"><v17:CustomerTransactionId xmlns:v17="http://fedex.com/ws/ship/v17">*** Ground Domestic Shipping Request using PHP ***</v17:CustomerTransactionId> </v17:TransactionDetail>  <v17:Version xmlns:v17="http://fedex.com/ws/ship/v17">     <v17:ServiceId xmlns:v17="http://fedex.com/ws/ship/v17">ship</v17:ServiceId>     <v17:Major xmlns:v17="http://fedex.com/ws/ship/v17">17</v17:Major>     <v17:Intermediate xmlns:v17="http://fedex.com/ws/ship/v17">0</v17:Intermediate>     <v17:Minor xmlns:v17="http://fedex.com/ws/ship/v17">0</v17:Minor>  </v17:Version> </v17:ProcessShipmentReply></SOAP-ENV:Body></SOAP-ENV:Envelope>

这是我正在制作的电话

//Creating new SoapClient and setting path to the Shipping .wsdl
$path_to_wsdl = $_SERVER['DOCUMENT_ROOT']."/portal/API/FedEx/wsdl/ShipService_v17.wsdl";
$client = new SoapClient($path_to_wsdl, array('trace' => 1));

//This is the snippet where I set the credentials
$masterRequest['WebAuthenticationDetail'] = array(
    'ParentCredential' => array(
        'Key' => getProperty('parentkey'),
        'Password' => getProperty('parentpassword')
    ),
    'UserCredential' => array(
        'Key' => FEDEX_KEY, 
        'Password' => FEDEX_PASSWORD
    )
);
$masterRequest['ClientDetail'] = array(
    'AccountNumber' => FEDEX_ACCOUNT_NUMBER, 
    'MeterNumber' => FEDEX_METER_NUMBER
);

1 个答案:

答案 0 :(得分:0)

FedEx帐号和电表号在测试与实时模式下有所不同 - 您是否相应更改了它们?您无法在测试和实时模式下使用相同的值。

您也可以在联邦快递开发者资源中心获取生产计量表编号,并在&#34;移至生产&#34;部分。