您好我需要一个源代码来访问Sabre Soap API,如PNR和预订API 我已经按照下面的方式访问了Flight搜索,但我知道我需要一种方法来连接Soap API
我确实阅读了Sabre网站上的所有文档并查看了所有Sabre代码示例https://developer.sabre.com/docs/workflows/book_air_segment/ https://developer.sabre.com/search?q=CreatePassengerNameRecordRQ
Dim request As HttpWebRequest
Dim response1, response2 As HttpWebResponse
Dim reader, reader2 As StreamReader
Dim Client_ID As String = "***************"
Dim Client_SEC As String = "****************"
Dim url As String = "https://developer.sabre.com/io-docs/getoauth2accesstoken?apiId=793&auth_flow=client_cred&client_id=" + Client_ID + "&client_secret=" + Client_SEC
request = DirectCast(WebRequest.Create(url), HttpWebRequest)
response1 = DirectCast(request.GetResponse(), HttpWebResponse)
reader = New StreamReader(response1.GetResponseStream())
Dim ser As JObject = JObject.Parse(reader.ReadToEnd())
Dim data As List(Of JToken) = ser.Children().ToList
Dim myAccessToken As String = ser("result")("access_token").Value(Of String)()
Dim f As String = From.Text
Dim t As String = too.Text
Dim d1 As String = String.Format("{0:dd-MM-yyyy}", Date1.Text)
Dim d2 As String = String.Format("{0:dd-MM-yyyy}", date2.Text)
Dim re As String = "https://api.test.sabre.com/v1/shop/flights?origin=" & f & "&destination=" & t & "&departuredate=" & d1 & "&returndate=" & d1 & "&onlineitinerariesonly=N&limit=10&offset=1&eticketsonly=N&sortby=totalfare&order=asc&sortby2=departuretime&order2=asc&pointofsalecountry=US"
Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create(re), HttpWebRequest)
postReq.Method = "GET"
postReq.ContentType = "application/x-www-form-urlencoded"
Dim header As String = "Authorization: Bearer " + myAccessToken
postReq.Headers.Add(header)
答案 0 :(得分:1)
访问Sabre SOAP系统并不像Airline Rest服务那么容易。然后,没有任何SOAP服务像Rest一样容易,这就是为什么每个人都在转换。据说可以获得肥皂是一个两阶段的过程。首先,您发送登录凭据以获取“二进制安全令牌”,然后该令牌将在每个后续SOAP请求的标头中发回。 此外,您还需要注意,如果您尚未访问PNR,则需要具有标准Sabre访问级别不具备的特殊级别的安全性。还需要签署成本和附加合同。您生成的每个PNR都必须支付相关费用。 一旦你通过Sabre获得PNR访问设置,我建议你使用.NET构建器为WSDL文件构建你的类。这内置于Visual Studio中,并构建了将负责与Saber通信所需的访问层的类。这很有效,可以让您只需按照文档操作,而不用担心如何发送或如何管理响应。它们只是作为您可以轻松管理的类进入。