联邦快递API.运输标签.多包货物



我正在使用联邦快递API来打印标签。1个软件包打印成功的标签,但是当我尝试打印多包时,我会收到一个错误:

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,但这不是帮助

$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
                                                 )
 );

有人知道如何成为有效的请求吗?

FedEx Rate API FedEx运输API 之间存在差异。您可以使用一个SOAP请求对多个软件包进行评分;但是,要运送多件装运(MPS),您必须为每个包裹执行运输请求。

第一个软件包(第一个请求中的软件包)将是您的 Master 包含主跟踪号。拥有此主跟踪号后,您必须将其附加到其余软件包的运输请求中。请,请参阅最新的 FedEx开发人员指南以获取有关MPS货物的更多信息,并下载从FedEx开发人员Portal执行 Empress express国内MPS运输的示例。

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

最好!

FedEx手册有一个错误:" MasterTrackingId"是错误的。" MasterTrackingId"是正确的。

我已经在测试服务器上工作了。我正在使用python和这个可爱的包装纸,所以这不是全面的肥皂写作,但是...货物基本上是:

SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP- ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="http://fedex.com/ws/ship/v25">
<SOAP-ENV:Body>
<ProcessShipmentRequest xmlns="http://fedex.com/ws/ship/v25">
<WebAuthenticationDetail> <ParentCredential>
<Key>Hb1TfWMygUh7bbHP</Key>
<Password>u0mnYl8d6FRQK5Ot8SyxMXVqq</Password> </ParentCredential>
<UserCredential>
<Key>INPUT YOUR INFORMATION</Key>
<Password> INPUT YOUR INFORMATION </Password> </UserCredential>
</WebAuthenticationDetail> <ClientDetail>
<AccountNumber>XXXXXXXXX</AccountNumber>
<MeterNumber>XXXXXX</MeterNumber> </ClientDetail>
<TransactionDetail>
<CustomerTransactionId>ProcessShipmentRequest_2264</CustomerTransactionId> </TransactionDetail>
<Version>
<ServiceId>ship</ServiceId> <Major>25</Major> <Intermediate>0</Intermediate>
<Minor>0</Minor> </Version> <RequestedShipment>

以及任何需要关闭的东西,我们都有基本的装运废话,然后...

shipment.RequestedShipment.TotalWeight.Value
shipment.RequestedShipment.TotalWeight.Units
shipment.RequestedShipment.PackageCount

在您的第一次装运上。在该货物请求中拥有您的第一个包裹,但包括SequenceNumber = 1

<RequestedPackageLineItems>
<SequenceNumber>1</SequenceNumber> 
<Weight>
<Units>LB</Units>
<Value>20.0</Value> 
</Weight> 
<Dimensions>
<Length>12</Length> 
<Width>12</Width> 
<Height>12</Height> 
<Units>IN</Units>
</Dimensions> 
</RequestedPackageLineItems>

提交带有包裹请求的货物。在该货物的回应中,您将服用CompletedShipmentDetail.MasterTrackingId。在随后的货物中,您将像往常一样形成它们,除非您包括

RequestedShipment.MasterTrackingId.TrackingIdType

RequestedShipment.MasterTrackingId.MasterTrackingId

MasterTrackingId是从第一次发货中取出的;WDSL将具有TrackingIdType的列表。我认为仅使用"联邦快递"是可以的。装运的重量和包装计数就像是正常的装运 - 包装重量和1.包装行项目的编号将增加直到您到达PackageCount

我希望这会增加@Ozzy Garcia的答案!他们肯定比联邦快递的文档更亮了!

最新更新