我正在收到以下错误消息
<faultcode>soap-env:Client.InvalidSecurityToken</faultcode><faultstring>Invalid or Expired binary security token: null</faultstring><detail><StackTrace>com.sabre.universalservices.base.security.AuthenticationException: errors.session.USG_INVALID_SECURITY_TOKEN</StackTrace></detail></soap-env:Fault></soap-env:Body></soap-env:Envelope>
以下是我对酒店可用性API的要求。
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" SOAP-ENV:mustUnderstand="0">
<eb:From>
<eb:PartyId eb:type="urn:x12.org:IO5:01">client</eb:PartyId>
</eb:From>
<eb:To>
<eb:PartyId eb:type="urn:x12.org:IO5:01">ws</eb:PartyId>
</eb:To>
<eb:CPAId>'.$pcc.'</eb:CPAId>
<eb:ConversationId>YourConversationId</eb:ConversationId>
<eb:Service eb:type="sabreXML"></eb:Service>
<eb:Action>OTA_HotelAvailLLSRQ</eb:Action>
</eb:MessageHeader>
<Security xmlns:ns6="http://schemas.xmlsoap.org/ws/2002/12/secext" SOAP-ENV:mustUnderstand="0">
<BinarySecurityToken>'.$sabreKey.'</BinarySecurityToken>
</Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<eb:OTA_HotelAvailRQ xmlns:eb="http://webservices.sabre.com/sabreXML/2003/07" TimeStamp="2011-01-26T12:30:00-06:00" Version="1.10.1">
<eb:POS>
<eb:Source PseudoCityCode="'.$pcc.'" /></eb:POS>
<eb:AvailRequestSegments>
<eb:AvailRequestSegment>
<eb:StayDateRange Start="12-10" End="12-15" />
<eb:RoomStayCandidates>
<eb:RoomStayCandidate>
<eb:GuestCounts>
<eb:GuestCount Count="1" /></eb:GuestCounts>
</eb:RoomStayCandidate>
</eb:RoomStayCandidates>
<eb:HotelSearchCriteria xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="eb:HotelSearchCriteria_type0">
<eb:Criterion>
<eb:HotelRef HotelCityCode="DFW" /></eb:Criterion>
</eb:HotelSearchCriteria>
</eb:AvailRequestSegment>
</eb:AvailRequestSegments>
</eb:OTA_HotelAvailRQ>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
这是向酒店可用性API提出要求之前所做的。我收到了我的WSSE:SessionCreaterq的二进制securityToken存储了包含令牌的变量。
<BinarySecurityToken>'.$sabreKey.'</BinarySecurityToken>
为什么我会收到此错误消息我的凭据是正确的。顺便说一句,我有生产证书。
谢谢我期待一些帮助
如果您认为安全令牌是正确的,则可能在不正确的环境下工作。例如,如果您在prod上创建了一个会话,却将后续请求发送给证书,则将返回此错误。
确保两个请求都发送到同一端点。如果问题仍然存在,请联系Helpdesk。
解决了问题。这是问题的问题,要说的是在请求中包含以下标签。
<eb:Security xmlns:ns6="http://schemas.xmlsoap.org/ws/2002/12/secext" SOAP-ENV:mustUnderstand="0">
<eb:BinarySecurityToken>'.$sabreKey.'</eb:BinarySecurityToken>
</eb:Security>
,但这导致了错误。
所以我尝试删除EB名称空间和以下位置。
<Security xmlns:ns6="http://schemas.xmlsoap.org/ws/2002/12/secext" SOAP-ENV:mustUnderstand="0">
<BinarySecurityToken>'.$sabreKey.'</BinarySecurityToken>
</Security>
如果您在我的结果中查看XML请求。您会明白这无效。然后,我尝试再次更改标签并使其工作。
我现在正在使用的标签我正在阅读的文档中,这让我感到困惑。通过使用以下标签是我如何工作请求。
<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
<wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">'.$sabreKey.'</wsse:BinarySecurityToken>
</wsse:Security>
我敢肯定,这将帮助许多人,因为该文档在此特定标签时存在缺陷。