首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >联邦快递API。装运标签。多包装运

联邦快递API。装运标签。多包装运
EN

Stack Overflow用户
提问于 2012-12-26 19:42:58
回答 3查看 11.5K关注 0票数 6

我正在使用FeDex应用程序接口来打印运输标签。1个包的标签打印成功,但当我尝试打印多个包时,我得到一个错误:

代码语言:javascript
复制
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,但这无济于事

代码语言:javascript
复制
$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
                                                 )
 );

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

EN

回答 3

Stack Overflow用户

发布于 2013-05-09 12:59:21

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

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

需要注意的是,发货过程不是以事务的形式发生的,因此,如果您尝试发货3个包裹,并且成功提交了包裹1和2,但包裹3由于未知原因失败,则您需要负责取消包裹1和2或重新提交包裹3。我建议任何人在创建实际发货之前验证发货(使用相同的发货API)。

最好的!

票数 19
EN

Stack Overflow用户

发布于 2013-03-22 16:24:15

FeDex手册中有一个错误:"MasterTrackingID“错误。"MasterTrackingId“是对的。

票数 1
EN

Stack Overflow用户

发布于 2021-11-10 17:49:56

我已经让MPS在测试服务器上工作了。我使用的是python和this lovely wrapper,所以这不是一个完整的SOAP编写,但是...其中发货基本上是:

代码语言:javascript
复制
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>

不管需要什么闭包,我们已经有了基本的装运垃圾,然后...

代码语言:javascript
复制
shipment.RequestedShipment.TotalWeight.Value
shipment.RequestedShipment.TotalWeight.Units
shipment.RequestedShipment.PackageCount

你的第一批货。无论您的第一个包裹是什么,请在发货请求中包含SequenceNumber = 1

代码语言:javascript
复制
<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。在随后的发货中,您只需像往常一样形成它们,只是,您将包括一个

代码语言:javascript
复制
RequestedShipment.MasterTrackingId.TrackingIdType

代码语言:javascript
复制
RequestedShipment.MasterTrackingId.MasterTrackingId

其中MasterTrackingId是从第一批货物中提取的;WDSL将具有TrackingIdType的列表。我认为只要使用“联邦快递”就可以了。装运重量和包裹计数将与普通装运一样--包裹重量和1。包裹行项目的编号将递增,直到到达PackageCount为止。

我希望这对@Ozzy的回答有所帮助!他们肯定比联邦快递的文档更能说明这一点!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14040137

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档