0

我正在尝试为跟踪包实现 DHL API。一切正常,我从 DHL 服务器接收数据,但是,我不明白应该如何在请求中使用 MessageTime 和 MessageReference 值,我应该在每个参数中输入什么或如何做到这一点。谢谢

<ServiceHeader>
<MessageTime>2019-09-23T15:54:10</MessageTime>                  
<MessageReference>xxxx</MessageReference>
</ServiceHeader>
4

1 回答 1

0

它会在 API 文档中得到很好的评论。

我个人在发货 API 中使用了以下内容,这些评论是从提供的文档中收集的。

这是来自我的个人代码,不是跟踪 API,但我想它会相似且一致:

// Mandatory - The MessageTime element contains the time at which the message was sent by the requestor. The format of
// the element should be YYYY-MM-DD(T)hh-mm-ss - Time Zone where “T” is the separator between date
// and time
request.ServiceHeader.MessageTime = DateTime.Now;

// Mandatory - The MessageReference element should contain a unique reference to the message, so that trace of
// a particular message can easily be carried out. It must be a minimum length of 28 and maximum
// 32.The value can be decided by the customer.
request.ServiceHeader.MessageReference = Guid.NewGuid().ToString("N");

编辑

我仔细检查了跟踪 API,结果是一样的:

在此处输入图像描述

于 2019-09-25T06:12:59.687 回答