Sabre GDS SOAP Web Service with PHP Done Right

I recently had the opportunity to work with Sabre’s Global Distribution System SOAP web service. The Sabre GDS powers everything from hotel bookings, to flights and cruises. Most hotels and airlines add inventory into Sabre allowing booking agencies and travel websites to display this data to customers and book travel plans through the GDS. Sabre is old and some of its client systems look almost VAX like, so working with it can be difficult at times.

If you are reading this post you’ve probably concluded that PHPs native SOAP client cannot easily consume Sabre’s GDS web service. I gave up on it after about a day. I had gone this route to replace a pre-existing solution that resulted in socket timeout errors. The current solution for PHP developers floating around the internet is slow and unreliable. After digging deep into the PHP SOAP Client documentation I discovered a middle ground approach between consuming the WSDL (which doesn’t work) and writing raw socket connections (which barely works).

The approach is pretty nifty and not a bad approach if you really hate dealing with WSDL’s in general as you can get most of the benefits of the native PHP Soap Client without a lot of the fuss. The trick is to use SoapClient::__doRequest. This allows you to use raw XML and still transport the data to the SOAP server using native SOAP code built into PHP. Below I’ll post some code that initiates a new Sabre session using SoapClient::__doRequest.

Prior to this we need to set $sabreSoapServer, $username, $password, and $pcc variables according to the authentication data provided by the Sabre web service team. Next we create a raw soap envelope and store it in $xmlString. Then create an instance of SoapClient as $client and make our call to __doRequest. This will return a raw soap response that we can parse with simplexml_load_string or any other xml library. I titled this done right, but perhaps its only done better. Please reply to this if you found a better way of handling this. Happy coding!

6 Comments

  • Phu Huynh says:

    Hi Chris,

    How can I get information of $sabreSoapServer, $username, $password, and $pcc.

    Can you give me an example of $sabreSoapServer.

    Thanks & Best regards
    Phu.Huynh

  • Chandra says:

    how do i call this in my ur code i dot pcc user and server as well

  • Chandra says:

    i have got all the credentials frm sabre. but could not figure it out how to create session and get flight details. please help..
    ASAP

  • Vivente says:

    Hi, excuseme i try use your code but no work, have you any upgrade for this code? I have last versión from PHP. Thanks

  • chris says:

    If you’re going to post comments, please be more specific. “Code does not work” tells me nothing. Do you experience errors? You wouldn’t accept these kinds of bug reports from users, so why would you describe problems like this to another developer? I think the post speaks for itself, use SoapClient::__doRequest, pass in the raw xml, and use the sabre web services documentation for everything else. With that said, if you have a specific question or specific problem and pose your question in way that isnt vague I will attempt answering it to the best of my abilities.