gpt4 book ai didi

php - FedEx XML Api 查询请求问题

转载 作者:行者123 更新时间:2023-12-04 13:50:17 24 4
gpt4 key购买 nike

我正在尝试使用 XML api 在项目中实现 FedEx 包裹跟踪。以下是我的跟踪请求:

'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v6="http://fedex.com/ws/track/v6">
<soapenv '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v6="http://fedex.com/ws/track/v6">
<soapenv:Header/>
<soapenv:Body>
<v6:TrackRequest>
<v6:WebAuthenticationDetail>
<v6:UserCredential>
<v6:Key>'.fedex_accesskey.'</v6:Key>
<v6:Password>'.fedex_password.'</v6:Password>
</v6:UserCredential>
</v6:WebAuthenticationDetail>
<v6:ClientDetail>
<v6:AccountNumber>'.fedex_account.'</v6:AccountNumber>
<v6:MeterNumber>'.fedex_meter.'</v6:MeterNumber>
<v6:IntegratorId></v6:IntegratorId>
<v6:Localization>
<v6:LanguageCode>EN</v6:LanguageCode>
<v6:LocaleCode>US</v6:LocaleCode>
</v6:Localization>
</v6:ClientDetail>
<v6:TransactionDetail>
<v6:CustomerTransactionId>Track By Number</v6:CustomerTransactionId>
<v6:Localization>
<v6:LanguageCode>EN</v6:LanguageCode>
<v6:LocaleCode>US</v6:LocaleCode>
</v6:Localization>
</v6:TransactionDetail>
<v6:Version>
<v6:ServiceId>trck</v6:ServiceId>
<v6:Major>6</v6:Major>
<v6:Intermediate>0</v6:Intermediate>
<v6:Minor>0</v6:Minor>
</v6:Version>
<v6:PackageIdentifier>
<v6:Value>'.$tracking_number.'</v6:Value>
<v6:Type>TRACKING_NUMBER_OR_DOORTAG</v6:Type>
</v6:PackageIdentifier>
</v6:TrackRequest>
</soapenv:Body>
</soapenv:Envelope>';:Header/>
<soapenv:Body>
<v6:TrackRequest>
<v6:WebAuthenticationDetail>
<v6:UserCredential>
<v6:Key>'.fedex_accesskey.'</v6:Key>
<v6:Password>'.fedex_password.'</v6:Password>
</v6:UserCredential>
</v6:WebAuthenticationDetail>
<v6:ClientDetail>
<v6:AccountNumber>'.fedex_account.'</v6:AccountNumber>
<v6:MeterNumber>'.fedex_meter.'</v6:MeterNumber>
<v6:IntegratorId></v6:IntegratorId>
<v6:Localization>
<v6:LanguageCode>EN</v6:LanguageCode>
<v6:LocaleCode>US</v6:LocaleCode>
</v6:Localization>
</v6:ClientDetail>
<v6:TransactionDetail>
<v6:CustomerTransactionId>Track By Number</v6:CustomerTransactionId>
<v6:Localization>
<v6:LanguageCode>EN</v6:LanguageCode>
<v6:LocaleCode>US</v6:LocaleCode>
</v6:Localization>
</v6:TransactionDetail>
<v6:Version>
<v6:ServiceId>trck</v6:ServiceId>
<v6:Major>6</v6:Major>
<v6:Intermediate>0</v6:Intermediate>
<v6:Minor>0</v6:Minor>
</v6:Version>
<v6:PackageIdentifier>
<v6:Value>'.$tracking_number.'</v6:Value>
<v6:Type>TRACKING_NUMBER_OR_DOORTAG</v6:Type>
</v6:PackageIdentifier>
</v6:TrackRequest>
</soapenv:Body>
</soapenv:Envelope>';

所有值都被正确交换,我从 FedEx 收到成功响应。问题是响应只有一个跟踪事件。该事件似乎是 FedEx 的最后一次跟踪更新(在本例中为交货时间、日期和地址),但并未显示沿途的任何跟踪事件。

这是我得到的回复:Pastebin

可以看到,包裹状态是delivered,里面有收货地址,但是没有发货地和途中的步骤。关于如何获取所有跟踪信息而不仅仅是最近一步的任何建议?感谢帮助。

最佳答案

您没有将 IncludeDetailedScans 元素设置为 true。这是 SOAP 信封的示例:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<TrackRequest xmlns="http://fedex.com/ws/track/v6">
<WebAuthenticationDetail>
<CspCredential>
<Key>CSP_KEY</Key>
<Password>CSP_PASSWORD</Password>
</CspCredential>
<UserCredential>
<Key>DEVELOPER_KEY</Key>
<Password>DEVELOPER_PASSWORD</Password>
</UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
<AccountNumber>ACCOUNT_NUMBER</AccountNumber>
<MeterNumber>METER_NUMBER</MeterNumber>
<ClientProductId>CLIENT_PRODUCT_ID</ClientProductId>
<ClientProductVersion>CLIENT_PRODUCT_VERSION</ClientProductVersion>
</ClientDetail>
<Version>
<ServiceId>trck</ServiceId>
<Major>6</Major>
<Intermediate>0</Intermediate>
<Minor>0</Minor>
</Version>
<PackageIdentifier>
<Value>TRACKING_NUMBER</Value>
<Type>TRACKING_NUMBER_OR_DOORTAG</Type>
</PackageIdentifier>
<IncludeDetailedScans>true</IncludeDetailedScans>
</TrackRequest>
</soap:Body>
</soap:Envelope>

请注意,仅当您属于 FedEx CSP 计划时,之前的请求才有效,如果您不属于,则下面的代码适合您:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<TrackRequest xmlns="http://fedex.com/ws/track/v6">
<WebAuthenticationDetail>
<UserCredential>
<Key>DEVELOPER_KEY</Key>
<Password>DEVELOPER_PASSWORD</Password>
</UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
<AccountNumber>ACCOUNT_NUMBER</AccountNumber>
<MeterNumber>METER_NUMBER</MeterNumber>
</ClientDetail>
<Version>
<ServiceId>trck</ServiceId>
<Major>6</Major>
<Intermediate>0</Intermediate>
<Minor>0</Minor>
</Version>
<PackageIdentifier>
<Value>TRACKING_NUMBER</Value>
<Type>TRACKING_NUMBER_OR_DOORTAG</Type>
</PackageIdentifier>
<IncludeDetailedScans>true</IncludeDetailedScans>
</TrackRequest>
</soap:Body>
</soap:Envelope>

最好!

关于php - FedEx XML Api 查询请求问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17657171/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com