Brwa R. Hassan
Brwa R. Hassan

Reputation: 105

Accessing Sabre Soap APIs

hello i need a source code to access Sabre Soap APIs like PNR and Booking APIs i already did access Flight search as below but know i need a way to connect to Soap APIs

i did read all Docs in Sabre website and saw all Sabre code samples 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)

Upvotes: 0

Views: 807

Answers (1)

Shawn Rucker
Shawn Rucker

Reputation: 66

Accessing Sabre SOAP systems is not as easy as the Airline Rest services. Then again no SOAP services are as easy as Rest thats why everyone is converting over. That being said access to soap is a two stage process. First you have the send your login credentials to get back a "Binary Security Token" that token will then be sent back in the header of each subsequent SOAP request. Also you need to be aware if you are not already that accessing PNR's require a special level of security that does not come with your standard Sabre access level. Also there is a cost and additional contract that has to be signed. Each PNR you generate has an associated cost you must pay as well. Once you get you PNR access setup with Sabre I would suggest you built out your classes using the .NET builder for WSDL files. This is built into Visual studio and build out classes that will take care of the access layer you need to talk with Sabre. This works great and will allow you to simply follow the docs and not worry about how to send or how to manage the responses. They simply come in as classes that you can easily manage.

Upvotes: 1

Related Questions