2012-12-26 100 views
4

我使用FeDex API来发货标签打印。标签1个打印全成,但是当我试图打印多包我得到一个错误:Fedex API。运输标签。多包裹发货

stdClass Object 
(
[Severity] => ERROR 
[Source] => ship 
[Code] => 2463 
[Message] => The number of RequestedPackages in the RequestedShipment must be equal to 1 
[LocalizedMessage] => The number of RequestedPackages in the RequestedShipment must be equal to 1 
) 

在要求我包括总权重,PackageCount,但它是helpn't

$request['WebAuthenticationDetail'] = array('UserCredential' =>array('Key' => $auth['key'], 'Password' => $auth['password'])); 
$request['ClientDetail'] = array('AccountNumber' => $auth['accountNumber'], 'MeterNumber' => $auth['meterNumber']); 
$request['TransactionDetail'] = array('CustomerTransactionId' => '*** Ground Domestic Shipping Request v12 using PHP ***'); 
$request['Version'] = array('ServiceId' => 'ship', 'Major' => '12', 'Intermediate' => '1', 'Minor' => '0'); 
$request['RequestedShipment'] = array('ShipTimestamp' => date('c'), 
             'DropoffType' => 'REGULAR_PICKUP', // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION 
             'ServiceType' => 'FEDEX_GROUND', // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ... 
             'PackagingType' => 'YOUR_PACKAGING', // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ... 
             'Shipper' => $this->addShipper(), 
             'Recipient' => $this->recipient, 
             'ShippingChargesPayment' => $this->addShippingChargesPayment(), 
             'LabelSpecification' => $this->addLabelSpecification(), 
             'RateRequestTypes' => array('LIST'), // valid values ACCOUNT and LIST 
             'PackageCount' => count($this->packages), 
             'TotalWeight' => array('Value' => array_sum($this->packages), 'Units' => 'LB'), 
             'TotalShipmentWeight' => array('Value' => array_sum($this->packages), 'Units' => 'LB'), 
             'PackageDetail' => 'INDIVIDUAL_PACKAGES',           
             'RequestedPackageLineItems' => $this->packageLineItem//array('0' => $this->packageLineItem) 
);  


$this->packageLineItem[] = array('SequenceNumber'=>$i, 
       'GroupPackageCount' => count($this->packages), 
       'MasterTrackingID' => '123123123123', 
       'TotalShipmentWeight' => array('Value' => array_sum($this->packages), 'Units' => 'LB'), 
       'Weight' => array('Value' => $this->packages[$i-1], //weight!!!!!!!!!!!!! 
           'Units' => 'LB'), 
       'CustomerReferences' => array('0' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 
                 'Value' => 'GR4567892'), // valid values CUSTOMER_REFERENCE, INVOICE_NUMBER, P_O_NUMBER and SHIPMENT_INTEGRITY 
              '1' => array('CustomerReferenceType' => 'INVOICE_NUMBER', 
                 'Value' => 'INV4567892'), 
              '2' => array('CustomerReferenceType' => 'P_O_NUMBER', 
                 'Value' => 'PO4567892')), 
       'SpecialServicesRequested' => array('SpecialServiceTypes' => array('COD'), 
                'CodDetail' => array('CodCollectionAmount' => array('Currency' => 'USD', 'Amount' => 150), 
                     'CollectionType' => 'ANY')// ANY, GUARANTEED_FUNDS 
               ) 
); 

有谁知道如何成为一个有效的请求?

+0

你有没有得到这个答案?尽管“MasterTrackingId”正确,但我仍然收到同样的错误。 – user766987

回答

0

FeDex手册有错误:“MasterTrackingID”错误。 “MasterTrackingId”是正确的。

9

联邦快递费率API联邦快递航运API之间的差异。您可以使用一个SOAP请求对多个包进行评级;但是,若要发送多件货件(MPS),则必须为每个包裹执行送货请求。

第一封装(封装在第一请求中),将是您万事达包含主跟踪号码。一旦你有这个主跟踪号码,你必须把它附加到其余包裹的送货请求。请参阅最新联邦快递开发人员指南了解有关MPS货件的更多信息,并下载从FedEx开发人员门户网站执行快递国内MPS货件的示例。

需要注意的是,运送过程不会作为交易发生,因此如果您尝试运送3个包裹,且包裹1和2已成功提交,但包裹3由于未知原因而失败,则您负责取消包裹1和2或重新提交包裹3.我会建议任何人在创建实际货件之前验证货件(使用相同的运输API)。

最好!

+0

https://www.fedex.com/us/developer/WebHelp/fsms/1401/dvg/DVG-WebHelp/2_7_4_1_Single_Shot_Shipping_Method.htm中的页面解释了多件货物的单件运输方式,但我一直得到同样的错误。任何想法为什么? – trss

+0

我的意思是,你的答案表明这是不可能的。难道这不再被支持? – trss