我们目前正在尝试实现 GetVehAvailRQ SOAP API,但在调用 Sabre Web 服务时出现以下错误:
<stlh:ResultSummary>
<stlh:Error timeStamp="2019-12-17T06:31:44-06:00" status="NotProcessed" type="Validation">
<stlh:ReportingSystem instance="usg-prod3" host="p170">USG1</stlh:ReportingSystem>
<stlh:Message code="1142">cvc-complex-type.2.4.a: Invalid content was found starting with element 'SabreHeader'. One of '{"http://services.sabre.com/STL_Header/v120":SabreHeader, WC["http://www.ebxml.org/namespaces/messageHeader","http://schemas.xmlsoap.org/ws/2002/12/secext"]}' is expected.</stlh:Message>
<stlh:ShortText>ERR.SWS.CLIENT.VALIDATION_FAILED</stlh:ShortText>
</stlh:Error>
</stlh:ResultSummary>
我们尝试使用文档资源中的 wsdl here ,但 SOAP header 看起来与我们之前实现的任何 header 完全不同(包括 GetHotelAvailRQ 服务)。
为了使 Web 引用正常工作,我们不得不更改提供的 WSDL(见下文),因为 STL_Header 文件不一致:
下载的wsdl:
<xsd:import namespace="http://services.sabre.com/STL_Header/v02_02" schemaLocation="api/built-ins/STL2_Header_v02_01.xsd"/>
更新为:
<xsd:import namespace="http://services.sabre.com/STL_Header/v02_02" schemaLocation="api/built-ins/STL2_Header_v02_02.xsd"/>
完整的 wsdl 文件:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:service="http://services.sabre.com/car/avail/v1" xmlns:sws="https://webservices.sabre.com/websvc" xmlns:stlh2="http://services.sabre.com/STL_Header/v02_02" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" targetNamespace="https://webservices.sabre.com/websvc">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://services.sabre.com/car/avail/v1" schemaLocation="api/v1/GetVehAvailRQ.xsd"/>
<xsd:import namespace="http://services.sabre.com/car/avail/v1" schemaLocation="api/v1/GetVehAvailRS.xsd"/>
<xsd:import namespace="http://services.sabre.com/STL_Header/v02_02" schemaLocation="api/built-ins/STL2_Header_v02_02.xsd"/>
<xsd:import namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" schemaLocation="api/built-ins/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetVehAvailRQInput">
<wsdl:part name="header" element="stlh2:SabreHeader"/>
<wsdl:part name="header2" element="wsse:Security"/>
<wsdl:part name="body" element="service:GetVehAvailRQ"/>
</wsdl:message>
<wsdl:message name="GetVehAvailRQOutput">
<wsdl:part name="header" element="stlh2:SabreHeader"/>
<wsdl:part name="header2" element="wsse:Security"/>
<wsdl:part name="body" element="service:GetVehAvailRS"/>
</wsdl:message>
<wsdl:portType name="GetVehAvailRQPortType">
<wsdl:operation name="GetVehAvailRQ">
<wsdl:input message="sws:GetVehAvailRQInput"/>
<wsdl:output message="sws:GetVehAvailRQOutput"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="GetVehAvailRQSoapBinding" type="sws:GetVehAvailRQPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetVehAvailRQ">
<soap:operation soapAction="GetVehAvailRQ"/>
<wsdl:input>
<soap:header message="sws:GetVehAvailRQInput" part="header" use="literal"/>
<soap:header message="sws:GetVehAvailRQInput" part="header2" use="literal"/>
<soap:body parts="body" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:header message="sws:GetVehAvailRQOutput" part="header" use="literal"/>
<soap:header message="sws:GetVehAvailRQOutput" part="header2" use="literal"/>
<soap:body parts="body" use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="GetVehAvailRQService">
<wsdl:port name="GetVehAvailRQPortType" binding="sws:GetVehAvailRQSoapBinding">
<soap:address location="https://webservices.havail.sabre.com/websvc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
我们使用的请求对象如下所示:
<?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:Header>
<SabreHeader xmlns="http://services.sabre.com/STL_Header/v02_02">
<Service operation="GetVehAvailRQ" version="1.0.0" />
<Identification>
<ConversationID>iQServicesSession</ConversationID
<MessageID>**VALID SESSION ID**</MessageID>
</Identification>
</SabreHeader>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" />
</soap:Header>
<soap:Body>
<GetVehAvailRQ version="1.0.0" xmlns="http://services.sabre.com/car/avail/v1">
<SearchCriteria PickUpDate="2020-01-30" PickUpTime="08:00" ReturnDate="2020-01-31" ReturnTime="17:00">
<GeoRef>
<PickUpLocRef>
<GeoCode Latitude="51.8893852233887" Longitude="0.262348860502243" />
</PickUpLocRef>
<ReturnLocRef>
<GeoCode Latitude="51.8893852233887" Longitude="0.262348860502243" />
</ReturnLocRef>
</GeoRef>
<ImageRef>
<Image />
</ImageRef>
</SearchCriteria>
</GetVehAvailRQ>
</soap:Body>
</soap:Envelope>
这个新的 SOAP header 结构是否有可用的文档/POSTMAN API 示例?
提前致谢!
山姆
最佳答案
您可以使用来自另一个 SOAP 服务的任何 header ,因此这部分很常见。唯一的区别是 Action 值,您可以将其替换为 GetVehAvailRQ;
另一个建议是看看https://github.com/SabreDevStudio/postman-collections .
关于sabre - 新 Sabre header 类型的任何文档 - GetVehAvailRQ SOAP header 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59375254/