简体   繁体   English

Fedex Web服务(SOAP):代答服务

[英]Fedex Web Services (SOAP): Pickup Service

I'm trying to schedule pickup using Pickup Service. 我正在尝试使用皮卡服务安排取件。 First I send Pickup Availability request to get cutoff time, then use the result I get in Pickup Request. 首先,我发送Pickup Availability请求以获得截止时间,然后使用我在Pickup Request中获得的结果。 But after that I get error "Ready Time after Cutoff Time" for the time that is obviously before the cutoff time. 但在那之后我得到错误“切断时间后的准备时间”显然是在截止时间之前的时间。 In my example cutoff time returned is 16:00 but the latest time I can schedule pickup for is 11:00. 在我的例子中,返回的截止时间是16:00,但我可以安排取件的最晚时间是11:00。 Part of pickup availability response: 提货可用性响应的一部分:

<v3:ScheduleDay>SAME_DAY</v3:ScheduleDay>
<v3:Available>true</v3:Available>
<v3:PickupDate>2013-04-02</v3:PickupDate>
<v3:CutOffTime>16:00:00</v3:CutOffTime>

Part of schedule pickup request that produces error: 生成错误的计划提取请求的一部分:

<ns1:ReadyTimestamp>2013-04-02T13:00:00</ns1:ReadyTimestamp>
<ns1:CompanyCloseTime>20:00:00</ns1:CompanyCloseTime>

Here's full request/response code for two requests: http://pastebin.com/jqtfsRFc 以下是两个请求的完整请求/响应代码: http//pastebin.com/jqtfsRFc

UPD : More details according to the discussion in comments UPD :根据评论中的讨论更多细节

That's what written about ReadyTimestamp The time must be no later than the CutOffTime, which can be discovered with the PickupAvailabilityRequest. 这就是关于ReadyTimestamp的内容。时间必须不晚于CutOffTime,可以使用PickupAvailabilityRequest发现。

So I make a pickup availability request and see the reply: 所以我提出了一个提货可用性请求并看到答复:

<v3:ScheduleDay>SAME_DAY</v3:ScheduleDay>
<v3:Available>true</v3:Available>
<v3:PickupDate>2013-04-09</v3:PickupDate>
<v3:CutOffTime>16:00:00</v3:CutOffTime>

Documentation says that timestamps for Pickup Availability are used according to the local TZ (taken from zip code). 文档说明,根据本地TZ(取自邮政编码)使用取件可用性的时间戳。 Out local TZ is PST which has -07:00 offset from UTC. 本地TZ是PST,其与UTC的偏移为-07:00。 There's also a line in Pickup Availability reply that indicates the time when my Pickup Availability request was processed. 提货可用性回复中还有一行表示处理我的提货可用性请求的时间。 I checked and see that it is also in PST so this step looks working fine: <v3:RequestTimestamp>2013-03-26T11:58:37</v3:RequestTimestamp> 我检查并发现它也在PST中,所以这一步看起来很好: <v3:RequestTimestamp>2013-03-26T11:58:37</v3:RequestTimestamp>

So I got cutoff time 16:00 PST and the next step is to schedule actual pickup for the time that will not be later than cutoff time using Create Pickup request. 所以我在太平洋标准时间16:00截止时间,下一步是使用创建分拣请求安排实际取件时间不晚于截止时间。 For this request ReadyTimestamp should contain TZ info so I tried different date/time formats. 对于此请求, ReadyTimestamp应包含TZ信息,因此我尝试了不同的日期/时间格式。 So if I want to create pickup for 14:00 PST I try 2013-04-09T21:00:00 , 2013-04-09T21:00:00.000Z , 2013-04-09T21:00:00+00:00 , and 2013-04-09T14:00:00-07:00 . 因此,如果我想在太平洋标准时间14:00创建取件,我会尝试2013-04-09T21:00:00 2013-04-09T21:00:00.000Z2013-04-09T21:00:00+00:002013-04-09T14:00:00-07:00 In all of these cases I get error Ready Time after Cutoff Time . 在所有这些情况下,我Ready Time after Cutoff Time得到错误Ready Time after Cutoff Time I tried many different values and discovered that the latest time it works for is 04:00 PST (same as 11:00 UTC). 我尝试了很多不同的值,发现最新的工作时间是太平洋标准时间04:00(与UTC时间11:00相同)。 So 04:00 gives me success and 04:01 gives Ready Time after Cutoff Time and it works this way with any date/time format. 所以04:00给了我success ,04:01给了Ready Time after Cutoff Time ,它以任何日期/时间格式运行。

Have you noticed that the ReadyTimestamp in the Example CreatePickupRequest on page 76 你有没有注意到, ReadyTimestamp例子CreatePickupRequest76页

<q0:ReadyTimestamp>2011-08-02T08:00:18.282Z</q0:ReadyTimestamp>
<q0:CompanyCloseTime>17:00:00</q0:CompanyCloseTime>

Is given with the timezone code . 时区代码

UPD. UPD。 You can check php fedex api wrapper from github or fedex api wrapper from phpclasses. 您可以查看PHP联邦快递API包装从GitHub或联邦快递API包装从phpclasses。

If you want to pass Date in WebService request, The DateTime Data type for WSDL is 如果要在WebService请求中传递Date,则WSDL的DateTime数据类型为

class DateTime2 extends DateTime {
    function __toString() { 
        return $this->format("Y-m-d\TH:i:s.000\Z");
    }
}

$date = new DateTime2();

$client = new SoapClient(
    "http://www.myos.it/sp/smartphonelayer.asmx?wsdl", 
    array("trace" => 1)
);

$result = $client->SetReservation(array("RDescription"=>"Giuseppe Silvestri",
                                        "RNumber"=>2,
                                        "RPhoneNumber"=>"3286026817",
                                        "RDate"=>$date.""));

echo "REQUEST:".$client->__getLastRequest()."<br>"; 

print_r($result);

ReadyTimestamp in createPickup request takes timestamp as value createPickup请求中的ReadyTimestamp将时间戳作为值

example: 'ReadyTimestamp': '1404891463' 示例:'ReadyTimestamp':'1404891463'

This will work 这会奏效

you must have a difference between: a- when the package is ready b- cutoff time c- company close time. 您必须有以下区别:a-当包装准备好b-截止时间c-公司关闭时间。

consequently, if your zip code has a cutoff time of 16:00, your package must be ready before that time, and your company must be open up to a couple of hours later. 因此,如果您的邮政编码的截止时间为16:00,那么您的包裹必须在此之前准备好,并且您的公司必须在几个小时之后开放。

my suggestion. 我的建议。 place the company close time at 19:00, fedex latest pickup time usually is at 17hs for all zip codes. 公司关闭时间为19:00,联邦快递最新的取件时间通常为17小时,所有邮政编码。 those 2 your is because when you request a pickup the van courier has 2 hours to go to that place, if your company close time is only 1 hour from the pickup request you will experience problems. 那2个是你的,因为当你要求提货时,货车快递有2个小时到那个地方,如果你的公司关闭时间距离提货请求只有1小时,你会遇到问题。

hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM