2016-12-04 61 views
0

我收到以下错误消息军刀 - 酒店预订API - 错误

<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的BinarySecurityToken将包含该令牌的变量存储到。

<BinarySecurityToken>'.$sabreKey.'</BinarySecurityToken>                    

为什么我得到这个错误消息我的凭据是正确的。顺便说一句,我有生产证书。

谢谢,我很期待一些帮助

回答

0

如果你是积极的,安全令牌是正确的,你可能会在不正确的环境中工作。例如,如果您在PROD上创建会话但将后续请求发送给CERT,则会返回此错误。

确保两个请求都发送到同一端点。如果问题仍然存在,请联系帮助台。

+0

感谢您的回复。布鲁诺。这两个请求都被发送到同一端点。我找出问题所在,那不是它。我会在几分钟后发布解决方案,因为我确信我的解决方案将有助于很多未来面临同样问题的人。 –

0

问题已解决。以下是Sabre文档所述的问题,以在请求中包含以下标记。

<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> 

我相信这会帮助很多人,因为文档在涉及到这个特定标签时存在缺陷。