【问题标题】:National Rail SOAP XML API call via Postman通过 Postman 调用 National Rail SOAP XML API
【发布时间】:2017-08-03 11:17:15
【问题描述】:

尝试使用 SOAP XML 通过 Postman 调用 National Rail API,但得到“401 - 未经授权:由于凭据无效而拒绝访问”响应。这是我所拥有的:

地址栏

POST https://lite.realtime.nationalrail.co.uk/OpenLDBWS/ldb10.asmx

标题:

Content-Type: text/xml;charset=UTF-8
SOAPAction: http://thalesgroup.com/RTTI/2017-02-02/ldb/GetDepartureBoard
Accept-encoding: gzip, x-gzip, deflate, x-bzip2

主体:

<soap:Envelope
  xmlns:ldb="http://thalesgroup.com/RTTI/2017-02-02/ldb/"
  xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
  xmlns:typ="http://thalesgroup.com/RTTI/2017-02-02/Token/types">
  <soap:Header>
    <typ:AccessToken>
      <typ:TokenValue>**** token removed ****</typ:TokenValue>
    </typ:AccessToken>
  </soap:Header>
  <soap:Body>
    <ldb:GetDepartureBoardRequest>
      <ldb:crs>LST</ldb:crs>
      <ldb:numRows>10</ldb:numRows>
      <ldb:timeOffset>0</ldb:timeOffset>
      <ldb:timeWindow>120</ldb:timeWindow>
    </ldb:GetDepartureBoardRequest>
  </soap:Body>
</soap:Envelope>

这里有一些文档:https://lite.realtime.nationalrail.co.uk/openldbws/

此处调用示例:http://nrodwiki.rockshore.net/index.php/GetDepBoardWithDetails

任何帮助将不胜感激 - 我想了解如何正确进行 API 调用,以便我可以继续使用我的爱好项目应用程序。

【问题讨论】:

    标签: xml api soap


    【解决方案1】:

    把地址改成:

    https://lite.realtime.nationalrail.co.uk/OpenLDBWS/ldb9.asmx
    

    换肥皂:信封

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
     xmlns:typ="http://thalesgroup.com/RTTI/2013-11-28/Token/types"
     xmlns:ldb="http://thalesgroup.com/RTTI/2016-02-16/ldb/">
    

    如果您使用有效的令牌,这将起作用(我已在 Postman 中测试过)。

    希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-20
      • 1970-01-01
      • 2023-02-16
      • 2010-10-05
      • 1970-01-01
      • 1970-01-01
      • 2017-01-22
      • 1970-01-01
      相关资源
      最近更新 更多