This example takes the response data from the air booking in Sample 1 to retrieve Flight Information (commonly known as FLIFO). Flight Information eBL accepts a list of flights and returns all relevant details for each flight. Please note that various levels of Flight Information are not supported on all airlines.
Flight Information calls can be made either through the Flight Information eBL or by using the FlightInfo_6_0 transaction in the XML Select Web Service. In this example, the Flight Information eBL is used.
Create a proxy
of the XML Select Web Service, using a WSDL for your region or service
level. For example:
https://americas.copy-webservices.travelport.com/B2BGateway/service/FlightInformation?WSDL.
A sample of a proxy created by VisualStudio.NET is available at the Sample Site.
Most toolkits do not explicitly support proxies that connect to a Web Service via a secured firewall. See Connecting to Galileo Web Services for more details about working with proxy servers and other authentication issues.
Create a function, FWSController, which formats an XML template, retrieves the required data from the AirAvailability_6_2 response, and sets the parameters for the request. The following code also contains proxy server credentials that are included with the request to bypass the firewall.
Declares the required namespaces.
|
Imports System |
Imports System.Xml | |
Imports System.Net | |
Imports System.Xml.XPath | |
| |
Imports GettingStarted.com.galileo.testws2 | |
| |
Namespace GettingStarted | |
|
|
Declares the FWSController class, which manages the Flight Information eBL request. |
Public Class FWSController |
No constructor logic is required. |
Public Sub New() |
End Sub | |
|
|
Select the first air segment from a valid air availability response. Use a DOM to create the request. |
Public Function DoFlightInformation(ByVal requestDOM As XmlDocument) As XmlNode |
Get a web service proxy from the factory. |
Dim fws As FlightInformationWebService = New FlightInformationWebService() |
Create and set up the credentials for Flight Information eBL. User name and password are assigned by Galileo. Flight Information eBL uses Basic Authentication, however, Windows XP defaults to Digest Authentication. |
Dim UserName As String = "UserName" |
Dim Password As String = "Password" | |
Dim credentials As NetworkCredential = New NetworkCredential(UserName, Password) | |
Dim cc As CredentialCache = New CredentialCache() | |
cc.Add(New Uri(fws.Url), "Basic", credentials) | |
fws.Credentials = cc | |
Sets up a web broxy to get through the firewall, if necessary. URL of the proxy server. Confirm that the appropriate port is included. |
Dim wp As WebProxy = New WebProxy() |
wp.Address = New Uri("http://yourproxy.company.com:80") | |
wp.BypassProxyOnLocal = True | |
The User ID, password, and domain for the proxy server. |
wp.Credentials = New NetworkCredential("userID", "password", "proxyDomain") |
|
fws.Proxy = wp |
Specifies the Document (root) XML element for the request and filter. This example uses the GetInformation method. To receive full response data, a Host Access Profile (HAP) is required for each CRS, Galileo and Apollo. See How Flight Information eBL Works for more information. |
Dim responseElement As XmlElement = fws.GetInformation("GalileoHAP", "ApolloHAP", requestDOM.DocumentElement) |
Returns the response data as an XML element. |
Return responseElement |
|
End Function |
|
|
|
Public Function CreateRequest(ByVal xmlAirAvail As XmlElement) As XmlDocument |
Creates an XML Document. |
Dim doc As XmlDocument = New XmlDocument() |
Gets the required information from the AirAvailability_6_2 response. |
Dim firstSegment As XmlNode = xmlAirAvail.SelectSingleNode("AirAvail/AvailFlt[1]") |
Gets the departure date and time. |
Dim dt As String = GetText(firstSegment, "StartDt") |
Dim departDateTime As DateTime = DateTime.ParseExact(dt, "yyyyMMdd", Nothing) | |
Gets the flight number. |
Dim flightNum As String = GetText(firstSegment, "FltNum") |
Gets the departure airport. |
Dim departAirport As String = GetText(firstSegment, "StartAirp") |
Gets the arrival airport. |
Dim arriveAirport As String = GetText(firstSegment, "EndAirp") |
Gets the air vendor code. |
Dim airline As String = GetText(firstSegment, "AirV") |
|
|
Makes the Flight Information eBL request. The namespace is defined in the WSDL, whether ns.galileo.com or webservices.galileo.com |
Dim req As String = "" |
req += "<GWS_FlightInformationRQ xmlns='http://ns.galileo.com'>" | |
Request for all flight segments. |
req += " <Flights>" |
Flight segment request. The <Flight> element is repeated as necessary for additional segments. |
req += " <Flight " |
Airline vendor code. |
req += "airline='" + airline + "' " |
Flight number. |
req += "number='" + flightNum + "' " |
Departure date. |
req += "date='" + departDateTime.ToString("yyyy-MM-dd") + "' " |
Departure airport. |
req += "orig='" + departAirport + "' " |
Arrival airport. |
req += "dest='" + arriveAirport + "' />" |
End the flight request. |
req += " </Flights>" |
End the Flight Information eBL request. |
req += " </GWS_FlightInformationRQ>" |
|
|
|
doc.LoadXml(req) |
|
Return doc |
|
End Function |
|
|
GetText is a utility class that gets the content of the node pointed to by an XPath. Returns an empty string if there is no text or if the node does not exist. |
Private Function GetText(ByVal inNode As XmlNode, ByVal xPath As String) As String |
Dim tempNode As XmlNode = inNode.SelectSingleNode(xPath) | |
If (tempNode Is Nothing) Then | |
Return "" | |
End If | |
Return tempNode.InnerText | |
|
End Function |
|
End Class |
|
End Namespace |
The Apollo or Galileo CRS returns the following Flight Information eBL response.
Flight Information eBL response. |
<GWS_FlightInformationRS version="1.0.39.0" dateTime="2002-09-26T14:48:05:515Z" profileApollo="GalileoProd_APD" profileGalileo="ApolloProd_APD" xmlns="http://ns.galileo.com"> |
Flight response. The <Flight> section root element is essentially the same as the request, with the addition of a "source" attribute. |
<Flights> |
Airline vendor code, flight number, departure date, and departure and arrival airports. The "source" attribute allows clients to correlate flights in the request to flights in the response. |
<Flight airline="UA" number="258" date="2002-12-25" orig="DEN" dest="ORD" source="schedule"> |
An array of messages that apply to the entire trip, if available. |
<Messages /> |
The <City> element indicates additional segment information. Intermediate stops contain both departure and arrival data for the city. <Departure> elements may indicate a meal or equipment type. Variances indicate any deviation between scheduled, updated, and real-time data. Real-time data displays only for airline vendors that specifically supply this information. |
<Cities> |
<City code="DEN"> | |
<Departure scheduledDateTime="2002-12-25T11:50:00" meal="unknown"> | |
<Variances /> | |
</Departure> | |
</City> | |
<City code="ORD"> | |
<Arrival scheduledDateTime="2002-12-25T15:14:00"> | |
<Variances /> | |
</Arrival> | |
</City> | |
</Cities> | |
End of flight segment information. |
</Flight> |
End of flight information. |
</Flights> |
Flight Information eBL calls the Travel Codes Translator eBL to decode the airline vendor and airport codes into natural language. |
<Decode xmlns="http://ns.galileo.com"> |
<Airline Code="UA">United</Airline> | |
<Airport Code="DEN" StateProvinceCode="CO" CountryCode="US">Denver Intl Arpt</Airport> | |
<Airport Code="ORD" StateProvinceCode="IL" CountryCode="US">O'Hare Intl Arpt</Airport> | |
</Decode> | |
End of Flight Information eBL response. |
</GWS_FlightInformationRS> |
After retrieving the flight information, use the Reservation Builder eBL to cancel the PNR/Booking File in Sample 4.