【发布时间】:2020-06-22 20:47:50
【问题描述】:
FedEx 网络服务文档状态:
FedEx 提供了一种纯 XML Web 服务解决方案,您可以使用它来发送交易,而无需使用为 Web 服务提供 SOAP 协议支持的工具。
以下是他们在文档中使用的示例:
Example 3: HTTP POST
The following HTTP POST example is a valid working example. It is not guaranteed to work for all
programming languages, applications, and host systems:
POST /xml HTTP/1.0
Referrer: YourCompanyNameGoesHere
Host: ws.fedex.com
Port: 443
Accept: image/gif, image/jpeg, image/pjpeg, text/plain, text/html, */*
Content-Type: text/xml
Content-length: %d
Your FedEx Transaction
------------------------
Each line is followed by one new line character except Content-length and the FedEx transaction. Two new
line characters follow the Content-length line. The FedEx transaction has no extra characters. The Content length line should have the length of the FedEx transaction in place of the %d variable.
如果我想在 kotlin 中使用 HTTP post 调用设置一个普通的 xml 事务,那需要什么?
这是我要发送的 SOAP WSDL。通过输入跟踪号跟踪货件
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v18="http://fedex.com/ws/track/v18">
<soapenv:Header/>
<soapenv:Body>
<v18:TrackRequest>
<v18:WebAuthenticationDetail>
<v18:ParentCredential>
<v18:Key>INPUT YOUR INFORMATION</v18:Key>
<v18:Password>INPUT YOUR INFORMATION</v18:Password>
</v18:ParentCredential>
<v18:UserCredential>
<v18:Key>INPUT YOUR INFORMATION</v18:Key>
<v18:Password>INPUT YOUR INFORMATION</v18:Password>
</v18:UserCredential>
</v18:WebAuthenticationDetail>
<v18:ClientDetail>
<v18:AccountNumber>INPUT YOUR INFORMATION</v18:AccountNumber>
<v18:MeterNumber>INPUT YOUR INFORMATION</v18:MeterNumber>
<v18:Localization>
<v18:LanguageCode>EN</v18:LanguageCode>
</v18:Localization>
</v18:ClientDetail>
<v18:TransactionDetail>
<v18:CustomerTransactionId>Track By Number_v18</v18:CustomerTransactionId>
<v18:Localization>
<v18:LanguageCode>EN</v18:LanguageCode>
<v18:LocaleCode>US</v18:LocaleCode>
</v18:Localization>
</v18:TransactionDetail>
<v18:Version>
<v18:ServiceId>trck</v18:ServiceId>
<v18:Major>18</v18:Major>
<v18:Intermediate>0</v18:Intermediate>
<v18:Minor>0</v18:Minor>
</v18:Version>
<v18:SelectionDetails>
<v18:CarrierCode>FDXE</v18:CarrierCode>
<v18:PackageIdentifier>
<v18:Type>TRACKING_NUMBER_OR_DOORTAG</v18:Type>
<v18:Value>INPUT YOUR INFORMATION</v18:Value>
</v18:PackageIdentifier>
<v18:ShipmentAccountNumber/>
<v18:SecureSpodAccount/>
<v18:Destination>
<v18:GeographicCoordinates>rates evertitque aequora</v18:GeographicCoordinates>
</v18:Destination>
</v18:SelectionDetails>
</v18:TrackRequest>
</soapenv:Body>
</soapenv:Envelope>
【问题讨论】:
标签: xml http kotlin soap fedex