Perl Sample 1:
Requesting an Air Availability

Step 1 creates a general air availability request using the XML AirAvailability_6_5 transaction. The sample uses the minimum request parameters needed for availability of a one-way trip (single air segment) from Denver International Airport in Denver to O'Hare International Airport in Chicago. Currently, availability requests can be made only through transactions in the XML Select Web Service.

  1. 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/XMLSelect?WSDL
    .

  1. Create a function, XWSController, which formats an XML template 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 XWSController class, which manages the XML Select Web Service request.

package Controllers::XWS;

 

use SOAP::Lite +trace => 'debug';

 

 

Creates and sets up the credentials for the XML Select Web Service. The user name and password are assigned by Galileo.

Note
: Credentials are only required for one file in a module.  However, the credentials are included in each sample Controller so that they can function as stand-alone samples.

 

our $USER_NAME = "UserName";

our $PASSWORD  = "Password";

sub SOAP::Transport::HTTP::Client::get_basic_credentials {

return $USER_NAME => $PASSWORD;

 

}

 

 

The constructor for XML Select.

sub new {

 

my $type = shift;

 

my $self = {};

Defines the Host Access Profile, which is required to access Galileo Web Services.

$self->{HAP} = "HostAcessProfile";

Declares and initializes variables for the required namespaces and XML Select Web Service endpoint.

$self->{NAMESPACE} = 'http://webservices.galileo.com';

$self->{ENDPOINT} = 'https://americas.copy-webservices.travelport.com/B2BGateway/service/XMLSelect.asmx';

 

return bless $self, $type;

 

}

 

 

Builds an XML document using fixed endpoints and the required date.

sub BuildRequest

 

{

 

my $self = shift;

Finds the 15th of the month three months from the current date.

my $day = "15";

my $month = (localtime)[4] + 3;

my $year = (localtime)[5] + 1900;

 

if ($month > 12)

 

{

 

$month -=12;

 

$year += 1;

 

}

XML Select AirAvailability_6_2 transaction. See the AirAvailability_6_2 Sample Request for complete request parameters.

my $req;

$req .= "<AirAvailability_6_5>\r\n";

Air availability request.

$req .= "    <AirAvailMods>\r\n";

General air availability.

$req .= "        <GenAvail>\r\n";

Number of seats.

$req .= "            <NumSeats>1</NumSeats>\r\n";

Preferred class of service. If no specific class of service is requested, a CDATA structure is used to force a blank. The CRS will not process a zero value for this element.

$req .= "            <Class><![CDATA[ ]]></Class>\r\n";

Departure date for the flight segment. The CRS processes dates in a yyyyMMdd format.

$req .= "            <StartDt>".sprintf("%04d%02d%02d",$year, $month, $day)."</StartDt>\r\n";

Departure airport or city. Metro codes can be denoted with an asterisk, e.g., LAX*.

$req .= "            <StartPt>DEN</StartPt>\r\n";

Destination airport or city.

$req .= "            <EndPt>ORD</EndPt>\r\n";

Departure time at noon in a 24-hour clock, HHMM.  
Blank
for CRS default.

$req .= "            <StartTm>1200</StartTm>\r\n";

Time Window Indicator specifies if a time window applies to a D (departure time/date) or A (arrival time/date).

$req .= "            <TmWndInd>D</TmWndInd>\r\n";

Start and End Time of Departure/Arrival Window. Values in a 24-hour clock, HHMM.
Blank
if not used.

$req .= "            <StartTmWnd>0800</StartTmWnd>\r\n";

$req .= "            <EndTmWnd>1400</EndTmWnd>\r\n";

Flight type preference.
Blank
if no preference.

$req .= "            <FltTypeInd></FltTypeInd>\r\n";

Start point indicator.
Specifies the allowed departure airports.
B
(Select the specified airport first, then expand to other airports in a multi-airport city.)
Blank
(Use CRS default.)

$req .= "            <StartPtInd></StartPtInd>\r\n";

End point indicator.
B
(Destination as entered, either city or airport. This option expands airports to cities, giving preference to specified airport. For example, LAX would be processed as an airport.)
Blank
(Default to B).

$req .= "            <EndPtInd></EndPtInd>\r\n";

Ignore TravelScreen preferences.
Y
(Ignore TS preferences)
N
(Do not ignore TS preferences)
Blank
(Default to N)

$req .= "            <IgnoreTSPref></IgnoreTSPref>\r\n";

End general availability.

$req .= "        </GenAvail>\r\n";

End availability request.

$req .= "    </AirAvailMods>\r\n";

End XML Select transaction.

$req .= "</AirAvailability_6_5>\r\n";

 

return $req;

 

}

 

 

Builds a default filter that returns flight availability.

sub BuildFilter

 

{

 

my $self = shift;

A wildcard filter returns all data for flight availability <AvailFlt>.

return "<AirAvailability_6_5><AirAvail><AvailFlt><_/>
</AvailFlt></AirAvail></AirAvailability_6_5>";

 

}

 

 

Makes the availability call.

sub doAvail

 

{

 

my $self = shift;

 

 

Wraps the input parameters with the appropriate parameter names. SOAP::Lite does support this function for complex types, such as XML.

my $xmlFilter = '<Filter>'.(shift).'</Filter>';

my $xmlRequest = '<Request>'.(shift).'</Request>';

Saves the Filter and Request to the object.

$self->{filter} = $xmlFilter;

$self->{request} = $xmlRequest;

Instantiates the XWS Soap::Lite object.

my $xws = SOAP::Lite

Sets the URL for the XWS Soap Proxy.

-> uri($self->{NAMESPACE})

By default, Soap::Lite uses the pound sign (#) to concatenate URLs. Replace the pound sign with a slash (/).

-> on_action(sub{sprintf '%s/%s', @_ })

The default response is a hash value because the return type, xmlelement, is complex. Setting outputxml() to TRUE creates an XML response.

-> outputxml("1")

Sets the proxy endpoint to XML Select.

-> proxy($self->{ENDPOINT});

 

 

Assigns the return value of the XML Select object's call to the SubmitXml method.

my $response = $xws

Sets the namespace for the SubmitXml method parameters.

->call(SOAP::Data->name("SubmitXml")->attr({xmlns => $self->{NAMESPACE}}),

A Host Access Profile is required to access Galileo Web Services.

SOAP::Data->name(Profile => $self->{HAP})->type('string'),

Specifies the Document (root) XML element for the request and filter.

SOAP::Data->name(Request => $xmlRequest)->type('xml'),

SOAP::Data->name(Filter => $xmlFilter)->type('xml'));

Saves the response to the object.

$self->{response} = $response;

 

return $response;

 

}

 

  1. The Apollo or Galileo CRS returns 16 segments in an XML Select air availability response. The following code shows an example of the air availability summary for all segments as well as the first actual response segment. The complete response with all returned segments is available on the Galileo Web Services Sample Site. See the AirAvailability_6_5 Sample Response for complete response parameters.

XML Select AirAvailability_6_2 transaction.

<AirAvailability_6_5 xmlns="">

Air availability response.

<AirAvail>

When additional response segments are available, a More token is returned. A specific More token can only be used once. After each follow-on request, a new token is returned to be used for the next follow-on request.

<MoreToken>

<Tok>301060172164629495103170495884
</Tok>

</MoreToken>

Summary of returned segments.

<AvailSummary>

The total number of direct and connecting flight segments in response. The default number of availability responses is 16.

<NumSegs>16</NumSegs>

Airport or city code of the customer embarkation. Left justified, blank filled.

<StartPt>DEN</StartPt>

City code for requested origin city or airport.

<StartCity>DEN</StartCity>

Destination airport or city code.

<EndPt>ORD</EndPt>

City code for requested destination city or airport.

<EndCity>CHI</EndCity>

Error codes.

<ErrInd>0</ErrInd>

<ErrNum>0</ErrNum>

End of summary.

</AvailSummary>

Begin data for the first flight segment.

<AvailFlt>

Airline carrier (vendor) code.

<AirV>UA</AirV>

Flight number.

<FltNum>262</FltNum>

Optional suffix.
Reserved. Currently ignored.

<OpSuf />

Departure date of segment in YYYYMMDD format.

<StartDt>20020926</StartDt>

Departure airport code.

<StartAirp>DEN</StartAirp>

Destination airport code.

<EndAirp>ORD</EndAirp>

Departure time of this segment in a 24-hour clock HHmm.

<StartTm>1135</StartTm>

Arrival time of this flight segment in a 24-hour clock HHmm.

<EndTm>1455</EndTm>

Day change indicates the difference between departure and arrival dates. -1, 00, 01, 02 are valid.

<DayChg>00</DayChg>

Connection indicates that this flight segment connects to the next segment in the response.
Y
(Yes - flight connects to next segment)
N
(No)

<Conx>N</Conx>

Indicates a change of airport (crosstown) connection at the board point. Not applicable to the first flight segment of a connection.

<AirpChg>N</AirpChg>

Aircraft type. CHG indicates an aircraft change.

<Equip>777</Equip>

Reserved for future use. Currently ignored.

<Spare1 />

Number of intermediate stops between board and off points.

<NumStops>0</NumStops>

Indicates whether the carrier above differs from the carrier which actually operates the flight (code share).

<OpAirVInd>N</OpAirVInd>

On time performance indicator.
9
(90 to 100 percent),
8
(80 to 89.9 percent),
etc.

<Perf>8</Perf>

Type of sell agreement between CRS and link carrier.
SS
Secured Sell
Blank
(no agreement)

<LinkSellAgrmnt>SS</LinkSellAgrmnt>

Indicates if carrier has link (carrier-specific) display option.

<DispOption>Y</DispOption>

Indicates if carrier has Inside (polled) Availability option.

<InsideAvailOption>L</InsideAvailOption>

General traffic restriction indicators.

<GenTrafRestriction />

Contains a Y or an N for each day of the week starting with Sunday. Y indicates that the flight operates for that day of the week.

<DaysOperates>YYYYYYY</DaysOperates>

Total flying time (in minutes) for all segments of the journey.

<JrnyTm>140</JrnyTm>

Arrival Date in YYYYMMDD format.

<EndDt>20020926</EndDt>

Code share: Airline code for the carrier that actually operates this flight. Blank if no code share.

<OpAirV />

The operating carrier's flight designator for this flight. Blank if no code share.

<OpFltDesignator />

Reserved for future use. Currently ignored.

<OpFltSuf />

Used only for Flight-Specific Timetable.

<StartTerminal />

Used only for Flight-Specific Timetable.

<EndTerminal>1</EndTerminal>

Elapsed flight time in minutes.

<FltTm />

Indicates Last Seat Availability capability.

<LSAInd>N</LSAInd>

Carrier is a Galileo Participant.

<GalileoAirVInd>Y</GalileoAirVInd>

End data for first flight segment.

</AvailFlt>

Begin flight availability status.

<FltAvailStatus>

Indicates the operational status of this flight segment.

<FltStatus />

Indicates whether seats are available in First, Business, and Coach class, respectively.

A Seats are available
L
Waitlist open
C
Waitlist closed
N
Seats NOT available
R
Seats only available on request to airline

<First>A</First>

<Business>A</Business>

<Coach>A</Coach>

End of flight availability status.

</FltAvailStatus>

Begin booking code availability.

BIC (Booking Indicator Code) is the same as Class of Service.

<BICAvail>

Multiple BIC statuses may be listed, depending on the parameters of the availability request.

<BICStatusAry>

<BICStatus>

Booking Indicator Code (Class of Service).

<BIC>F</BIC>

The number of available seats for the class of service.

<Status>006</Status>

End of the BIC status.

</BICStatus>

End of the array.

</BICStatusAry>

End of the Booking Indicator Code availability.

</BICAvail>

 

...