【问题标题】:Fedex API. Shipping Label. Multiple-Package Shipments联邦快递 API。运输标签。多包货件
【发布时间】:2012-12-26 11:42:58
【问题描述】:

我正在使用 FeDex 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
)

在请求中我包括了 TotalWeight、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
                                                 )
 );

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

【问题讨论】:

  • 你有没有得到这个答案?尽管“MasterTrackingId”正确,但我目前收到了同样的错误。

标签: php fedex


【解决方案1】:

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

第一个包裹(第一个请求中的包裹)将是您的 Master,其中包含主跟踪号。获得此主跟踪号后,您必须将其附加到剩余包裹的运输请求中。请参阅最新的FedEx 开发人员指南,了解有关 MPS 货件的更多信息,并从 FedEx 开发人员门户下载执行国内快递 MPS 货件的示例。

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

最好的!

【讨论】:

  • fedex.com/us/developer/WebHelp/fsms/1401/dvg/DVG-WebHelp/… 的页面解释了多件装运的单次装运方法,但我一直收到同样的错误。知道为什么吗?
  • 我的意思是,您的回答表明这是不可能的。难道是不再支持这个?
  • @ozzy 我不知道在哪里将 Master Tracking 附加到剩余包裹的运输请求中?我在做 C#,但任何代码示例都可以
  • 我会为每个包裹单独收费还是只对第一个包裹设置收费字段?
  • 我搜索了 FedEx 开发人员指南,但找不到任何 MPS 肥皂请求的实际示例。
【解决方案2】:

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

【讨论】:

    【解决方案3】:

    我在测试服务器上安装了 MPS。我正在使用 python 和this lovely wrapper,所以它不是一个完整的 SOAP 写,但是...... 发货地基本上是:

    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 的列表。我认为只使用“FEDEX”就可以了。货件重量和包裹数将与普通货件一样 -- 包裹重量和 1。包裹行项目的编号将递增,直到您到达 PackageCount

    我希望这能增加@Ozzy Garcia 的回答!他们肯定比 FedEx 的文档更清楚地说明了这一点!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多