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) in 90 days from the current date from Denver International Airport in Denver to O'Hare International Airport in Chicago. Currently, availability requests can be made only through transactions in XML Select Web Service.
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.
A sample of a proxy created by Apache Axis is available in 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.
|
package com.galileo.GWSGettingStarted; |
|
import java.io.IOException; |
|
import java.io.StringReader; |
|
import java.text.MessageFormat; |
|
import java.util.Calendar; |
|
|
|
import javax.xml.parsers.ParserConfigurationException; |
|
|
|
import org.w3c.dom.Element; |
|
import org.xml.sax.SAXException; |
|
|
|
import com.galileo.webservices.XmlSelectLocator; |
|
import com.galileo.webservices.XmlSelectSoapStub; |
|
|
Declares the XWSController class, which manages the XML Select Web Service request. |
public class XWSController { |
|
|
|
public XWSController() {} |
|
|
|
public static void main(String[] args) |
{ | |
try { | |
XWSController xwc = new XWSController(); | |
xwc.doAvail(CreateRequest(), CreateFilter()); | |
} catch (ParserConfigurationException e) { | |
e.printStackTrace(); | |
} catch (SAXException e) { | |
e.printStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
| |
|
public Element doAvail(Element request, Element filter) |
|
{ |
|
XmlSelectLocator xservice = new XmlSelectLocator(); |
|
Element response = null; |
Uses the Web Service to get a stub that implements the SDI. |
try { |
xws
= (XmlSelectSoapStub)xservice.getXmlSelectSoap | |
The User Name and Password to access Galileo Web Services. |
xws.setUsername(USER_NAME); |
xws.setPassword(PASSWORD); | |
Submits the request using the SubmitXML method. A Host Access Profile is required to access Galileo Web Services. |
response = xws.submitXml(APOLLO_HAP, request, filter); |
|
} |
|
|
Exception handling. |
catch (Exception e) |
{ | |
System.err.println(e.getMessage()); | |
e.printStackTrace(System.err); | |
} | |
|
return response; |
|
} |
|
|
Builds a default filter that returns all available data. |
public
static Element CreateFilter() |
{ | |
A wildcard filter returns all data. |
return string2Element("<_/>"); |
|
} |
|
|
|
public
static Element CreateRequest() |
|
{ |
Creates a new Date class. |
Calendar tomorrow = Calendar.getInstance(); |
Finds the date in +90 days. |
tomorrow.add(Calendar.DATE,90); |
|
String
departDate = MessageFormat.format |
XML Select AirAvailability_6_2 transaction. See the AirAvailability_6_2 Sample Request for complete request parameters. |
String 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>" + departDate + "</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.
|
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. |
req += " <StartTmWnd>0800</StartTmWnd>\r\n"; |
req += " <EndTmWnd>1400</EndTmWnd>\r\n"; | |
Flight
type preference. |
req += " <FltTypeInd></FltTypeInd>\r\n"; |
Start
point indicator. |
req += " <StartPtInd></StartPtInd>\r\n"; |
End
point indicator. |
req += " <EndPtInd></EndPtInd>\r\n"; |
Ignore
TravelScreen preferences. |
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"; |
Returns the response data as an XML element. |
return string2Element(req); |
|
} |
|
|
|
private
static Element string2Element(String s) |
{ | |
return
org.apache.axis.utils.XMLUtils.newDocument | |
} | |
| |
Declares the constants. |
private XmlSelectSoapStub xws; |
private final String XWS_ENDPOINT = "https://americas.copy-webservices.travelport.com/B2BGateway/service/XMLSelect"; | |
private final String PASSWORD = "given_password"; | |
private final String USER_NAME = "given_USERNAME"; | |
private final String APOLLO_HAP = "HAP_PROVIDED_TO_YOU"; | |
|
} |
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 | |
</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. |
<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. |
<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. |
<Perf>8</Perf> |
Type of sell
agreement between CRS and link carrier. |
<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 |
<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> |
|
... |
The response data is used to book an air reservation in Step 2.