Fedex 是否提供折扣运费?
Does Fedex Provide Discounted Shipment Rates?
谁能帮我找到使用 FedEx 的费率服务 api?我有 3 个文件用于查找费率服务。
我从https://www.fedex.com/wpor/web/jsp/drclinks.jsp?links=wss/getstarted.html这里下载了所有三个文件。当我 运行 RateWebServiceClient.php 然后它显示错误:
事务返回错误。
严重性:错误
资料来源:教授
代码:1000
消息:身份验证失败
所有凭据,如 API 密钥、API 密码、电表编号、帐号都是正确的
1.fedex-普通.php5
2.RateWebServiceClient.php
3.RateService_v14.wsdl
require_once('fedex-common.php5');
$newline = "<br />";
//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "RateService_v24.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1));
$request['WebAuthenticationDetail'] = array(
'UserCredential' => array(
'Key' => getProperty('key'),
'Password' => getProperty('password')
)
);
$request['ClientDetail'] = array(
'AccountNumber' => getProperty('shipaccount'),
'MeterNumber' => getProperty('meter')
);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request using PHP ***');
$request['Version'] = array(
'ServiceId' => 'crs',
'Major' => '24',
'Intermediate' => '0',
'Minor' => '0'
);
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'INTERNATIONAL_PRIORITY'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['TotalInsuredValue']=array(
'Ammount'=>100,
'Currency'=>'USD'
);
$request['RequestedShipment']['Shipper'] = addShipper();
$request['RequestedShipment']['Recipient'] = addRecipient();
$request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1();
请尝试此代码。
<?php
$xml = '<?xml version="1.0" encoding="UTF-8"?>';
$xml .= '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/rate/v13">';
$xml .= '<SOAP-ENV:Body>';
$xml .= '<ns1:RateRequest>';
$xml .= '<ns1:WebAuthenticationDetail>';
$xml .= '<ns1:UserCredential>';
$xml .= '<ns1:Key></ns1:Key>'; // Use your Fedex Test Key Here
$xml .= '<ns1:Password></ns1:Password>'; //// Use your Fedex Test Password Here
$xml .= '</ns1:UserCredential>';
$xml .= '</ns1:WebAuthenticationDetail>';
$xml .= '<ns1:ClientDetail>';
$xml .= '<ns1:AccountNumber></ns1:AccountNumber>';
$xml .= '<ns1:MeterNumber></ns1:MeterNumber>';
$xml .= '</ns1:ClientDetail>';
$xml .= '<ns1:TransactionDetail>';
$xml .= '<ns1:CustomerTransactionId> *** Rate Request v13 using PHP ***</ns1:CustomerTransactionId>';
$xml .= '</ns1:TransactionDetail>';
$xml .= '<ns1:Version>';
$xml .= '<ns1:ServiceId>crs</ns1:ServiceId>';
$xml .= '<ns1:Major>13</ns1:Major>';
$xml .= '<ns1:Intermediate>0</ns1:Intermediate>';
$xml .= '<ns1:Minor>0</ns1:Minor>';
$xml .= '</ns1:Version>';
$xml .= '<ns1:ReturnTransitAndCommit>true</ns1:ReturnTransitAndCommit>';
$xml .= '<ns1:RequestedShipment>';
$xml .= '<ns1:DropoffType>REGULAR_PICKUP</ns1:DropoffType>';
$xml .= '<ns1:PackagingType>YOUR_PACKAGING</ns1:PackagingType>';
$xml .= '<ns1:TotalInsuredValue>';
$xml .= '<ns1:Currency>USD</ns1:Currency>';
$xml .= '</ns1:TotalInsuredValue>';
$xml .= '<ns1:Shipper>';
$xml .= '<ns1:Contact>';
$xml .= '<ns1:PersonName>Shipper Test Address</ns1:PersonName>';
$xml .= '<ns1:CompanyName>Sample Company</ns1:CompanyName>';
$xml .= '<ns1:PhoneNumber>800-5435-6789</ns1:PhoneNumber>';
$xml .= '</ns1:Contact>';
$xml .= '<ns1:Address>';
$xml .= '<ns1:StreetLines>1300 Basswood Road</ns1:StreetLines>';
$xml .= '<ns1:City></ns1:City>';
$xml .= '<ns1:StateOrProvinceCode>IL</ns1:StateOrProvinceCode>';
$xml .= '<ns1:PostalCode>60173</ns1:PostalCode>';
$xml .= '<ns1:CountryCode>US</ns1:CountryCode>';
$xml .= '</ns1:Address>';
$xml .= '</ns1:Shipper>';
$xml .= '<ns1:Recipient>';
$xml .= '<ns1:Contact>';
$xml .= '<ns1:PersonName>Harish</ns1:PersonName>';
$xml .= '<ns1:CompanyName>Test</ns1:CompanyName>';
$xml .= '<ns1:PhoneNumber>98656789130</ns1:PhoneNumber>';
$xml .= '</ns1:Contact>';
$xml .= '<ns1:Address>';
$xml .= '<ns1:StreetLines>32 wall street albany</ns1:StreetLines>';
$xml .= '<ns1:City>Atlanta</ns1:City>';
$xml .= '<ns1:StateOrProvinceCode>GA</ns1:StateOrProvinceCode>';
$xml .= '<ns1:PostalCode>30318</ns1:PostalCode>';
$xml .= '<ns1:CountryCode>US</ns1:CountryCode>';
$xml .= '<ns1:Residential>true</ns1:Residential>';
$xml .= '</ns1:Address>';
$xml .= '</ns1:Recipient>';
$xml .= '<ns1:ShippingChargesPayment>';
$xml .= '<ns1:PaymentType>SENDER</ns1:PaymentType>';
$xml .= '<ns1:Payor>';
$xml .= '<ns1:ResponsibleParty>';
$xml .= '<ns1:AccountNumber>510087100</ns1:AccountNumber>';
$xml .= '</ns1:ResponsibleParty>';
$xml .= '</ns1:Payor>';
$xml .= '</ns1:ShippingChargesPayment>';
$xml .= '<ns1:RateRequestTypes>LIST</ns1:RateRequestTypes>';
$xml .= '<ns1:PackageCount>1</ns1:PackageCount>';
$xml .= '<ns1:RequestedPackageLineItems>';
$xml .= '<ns1:SequenceNumber>1</ns1:SequenceNumber>';
$xml .= '<ns1:GroupPackageCount>1</ns1:GroupPackageCount>';
$xml .= '<ns1:Weight>';
$xml .= '<ns1:Units>LB</ns1:Units>';
$xml .= '<ns1:Value>45</ns1:Value>';
$xml .= '</ns1:Weight>';
$xml .= '<ns1:Dimensions>';
$xml .= '<ns1:Length>12</ns1:Length>';
$xml .= '<ns1:Width>9</ns1:Width>';
$xml .= '<ns1:Height>8</ns1:Height>';
$xml .= '<ns1:Units>IN</ns1:Units>';
$xml .= '</ns1:Dimensions>';
$xml .= '</ns1:RequestedPackageLineItems>';
$xml .= '</ns1:RequestedShipment>';
$xml .= '</ns1:RateRequest>';
$xml .= '</SOAP-ENV:Body>';
$xml .= '</SOAP-ENV:Envelope>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://wsbeta.fedex.com:443/web-services');
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$result_xml = curl_exec($ch);
$result_xml = str_replace(array(':','-'), '', $result_xml);
$result = @simplexml_load_string($result_xml);
echo "<pre>";
print_r($result);
echo "</pre>";
?>
谁能帮我找到使用 FedEx 的费率服务 api?我有 3 个文件用于查找费率服务。
我从https://www.fedex.com/wpor/web/jsp/drclinks.jsp?links=wss/getstarted.html这里下载了所有三个文件。当我 运行 RateWebServiceClient.php 然后它显示错误:
事务返回错误。 严重性:错误 资料来源:教授 代码:1000 消息:身份验证失败
所有凭据,如 API 密钥、API 密码、电表编号、帐号都是正确的
1.fedex-普通.php5
2.RateWebServiceClient.php
3.RateService_v14.wsdl
require_once('fedex-common.php5');
$newline = "<br />";
//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "RateService_v24.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1));
$request['WebAuthenticationDetail'] = array(
'UserCredential' => array(
'Key' => getProperty('key'),
'Password' => getProperty('password')
)
);
$request['ClientDetail'] = array(
'AccountNumber' => getProperty('shipaccount'),
'MeterNumber' => getProperty('meter')
);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request using PHP ***');
$request['Version'] = array(
'ServiceId' => 'crs',
'Major' => '24',
'Intermediate' => '0',
'Minor' => '0'
);
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'INTERNATIONAL_PRIORITY'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['TotalInsuredValue']=array(
'Ammount'=>100,
'Currency'=>'USD'
);
$request['RequestedShipment']['Shipper'] = addShipper();
$request['RequestedShipment']['Recipient'] = addRecipient();
$request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1();
请尝试此代码。
<?php
$xml = '<?xml version="1.0" encoding="UTF-8"?>';
$xml .= '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/rate/v13">';
$xml .= '<SOAP-ENV:Body>';
$xml .= '<ns1:RateRequest>';
$xml .= '<ns1:WebAuthenticationDetail>';
$xml .= '<ns1:UserCredential>';
$xml .= '<ns1:Key></ns1:Key>'; // Use your Fedex Test Key Here
$xml .= '<ns1:Password></ns1:Password>'; //// Use your Fedex Test Password Here
$xml .= '</ns1:UserCredential>';
$xml .= '</ns1:WebAuthenticationDetail>';
$xml .= '<ns1:ClientDetail>';
$xml .= '<ns1:AccountNumber></ns1:AccountNumber>';
$xml .= '<ns1:MeterNumber></ns1:MeterNumber>';
$xml .= '</ns1:ClientDetail>';
$xml .= '<ns1:TransactionDetail>';
$xml .= '<ns1:CustomerTransactionId> *** Rate Request v13 using PHP ***</ns1:CustomerTransactionId>';
$xml .= '</ns1:TransactionDetail>';
$xml .= '<ns1:Version>';
$xml .= '<ns1:ServiceId>crs</ns1:ServiceId>';
$xml .= '<ns1:Major>13</ns1:Major>';
$xml .= '<ns1:Intermediate>0</ns1:Intermediate>';
$xml .= '<ns1:Minor>0</ns1:Minor>';
$xml .= '</ns1:Version>';
$xml .= '<ns1:ReturnTransitAndCommit>true</ns1:ReturnTransitAndCommit>';
$xml .= '<ns1:RequestedShipment>';
$xml .= '<ns1:DropoffType>REGULAR_PICKUP</ns1:DropoffType>';
$xml .= '<ns1:PackagingType>YOUR_PACKAGING</ns1:PackagingType>';
$xml .= '<ns1:TotalInsuredValue>';
$xml .= '<ns1:Currency>USD</ns1:Currency>';
$xml .= '</ns1:TotalInsuredValue>';
$xml .= '<ns1:Shipper>';
$xml .= '<ns1:Contact>';
$xml .= '<ns1:PersonName>Shipper Test Address</ns1:PersonName>';
$xml .= '<ns1:CompanyName>Sample Company</ns1:CompanyName>';
$xml .= '<ns1:PhoneNumber>800-5435-6789</ns1:PhoneNumber>';
$xml .= '</ns1:Contact>';
$xml .= '<ns1:Address>';
$xml .= '<ns1:StreetLines>1300 Basswood Road</ns1:StreetLines>';
$xml .= '<ns1:City></ns1:City>';
$xml .= '<ns1:StateOrProvinceCode>IL</ns1:StateOrProvinceCode>';
$xml .= '<ns1:PostalCode>60173</ns1:PostalCode>';
$xml .= '<ns1:CountryCode>US</ns1:CountryCode>';
$xml .= '</ns1:Address>';
$xml .= '</ns1:Shipper>';
$xml .= '<ns1:Recipient>';
$xml .= '<ns1:Contact>';
$xml .= '<ns1:PersonName>Harish</ns1:PersonName>';
$xml .= '<ns1:CompanyName>Test</ns1:CompanyName>';
$xml .= '<ns1:PhoneNumber>98656789130</ns1:PhoneNumber>';
$xml .= '</ns1:Contact>';
$xml .= '<ns1:Address>';
$xml .= '<ns1:StreetLines>32 wall street albany</ns1:StreetLines>';
$xml .= '<ns1:City>Atlanta</ns1:City>';
$xml .= '<ns1:StateOrProvinceCode>GA</ns1:StateOrProvinceCode>';
$xml .= '<ns1:PostalCode>30318</ns1:PostalCode>';
$xml .= '<ns1:CountryCode>US</ns1:CountryCode>';
$xml .= '<ns1:Residential>true</ns1:Residential>';
$xml .= '</ns1:Address>';
$xml .= '</ns1:Recipient>';
$xml .= '<ns1:ShippingChargesPayment>';
$xml .= '<ns1:PaymentType>SENDER</ns1:PaymentType>';
$xml .= '<ns1:Payor>';
$xml .= '<ns1:ResponsibleParty>';
$xml .= '<ns1:AccountNumber>510087100</ns1:AccountNumber>';
$xml .= '</ns1:ResponsibleParty>';
$xml .= '</ns1:Payor>';
$xml .= '</ns1:ShippingChargesPayment>';
$xml .= '<ns1:RateRequestTypes>LIST</ns1:RateRequestTypes>';
$xml .= '<ns1:PackageCount>1</ns1:PackageCount>';
$xml .= '<ns1:RequestedPackageLineItems>';
$xml .= '<ns1:SequenceNumber>1</ns1:SequenceNumber>';
$xml .= '<ns1:GroupPackageCount>1</ns1:GroupPackageCount>';
$xml .= '<ns1:Weight>';
$xml .= '<ns1:Units>LB</ns1:Units>';
$xml .= '<ns1:Value>45</ns1:Value>';
$xml .= '</ns1:Weight>';
$xml .= '<ns1:Dimensions>';
$xml .= '<ns1:Length>12</ns1:Length>';
$xml .= '<ns1:Width>9</ns1:Width>';
$xml .= '<ns1:Height>8</ns1:Height>';
$xml .= '<ns1:Units>IN</ns1:Units>';
$xml .= '</ns1:Dimensions>';
$xml .= '</ns1:RequestedPackageLineItems>';
$xml .= '</ns1:RequestedShipment>';
$xml .= '</ns1:RateRequest>';
$xml .= '</SOAP-ENV:Body>';
$xml .= '</SOAP-ENV:Envelope>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://wsbeta.fedex.com:443/web-services');
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$result_xml = curl_exec($ch);
$result_xml = str_replace(array(':','-'), '', $result_xml);
$result = @simplexml_load_string($result_xml);
echo "<pre>";
print_r($result);
echo "</pre>";
?>