Java Sample 5:
Retrieving Itinerary Data

In this example, a confirmation number (record locator) is used to retrieve an itinerary (PNR/BF) booked in Sample 2. Detail from the itinerary is then be extracted for display to the traveler. This example uses Itinerary eBL, which allows the itinerary detail to be retrieved in one call to the CRS.

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

  2. Create a function, ItineraryController, which formats an XML template, retrieves the required data from the Reservation Builder eBL 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.

 

package com.galileo.GWSGettingStarted;

 

 

 

import java.io.StringReader;

 

import java.text.MessageFormat;

 

import java.util.Calendar;

 

 

 

import org.w3c.dom.Document;

 

import org.w3c.dom.Element;

 

import org.w3c.dom.NodeList;

 

 

 

import com.galileo.webservices.*;

 

 

Declares the Itinerary class, which manages the Itinerary eBL request.

public class ItineraryController {

 

public Element CreateRequest(Element bookingResponse)

 

{

Retrieves the record locator from the Booking response in Sample 2.

String recloc = Util.GetText(bookingResponse,
"RecordLocator");

 

StringBuffer req = new StringBuffer();

Indicates the namespace used.

req.append("<RetrieveTrip_RQ ");

Indicates the response will return a description of the passenger's air segment, if available.

req.append("AdditionalAirSegmentInfo='1' ");

Indicates the response will return a description of the passenger's car segment, if available.

req.append("AdditionalCarSegmentInfo='1' ");

Indicates the response will return a description of the passenger's hotel segment, if available.

req.append("AdditionalHotelSegmentInfo='1' ");

Indicates the response will return a description of the passenger's W3 segment, if available.

req.append("AdditionalW3SegmentInfo='0' ");

Indicates that the response will decode any information that was requested to be encoded.

Note: This request does not decode in place. A decode node is appended to the end of the document that contains codes and their human language equivalents.

req.append("DecodeItems='1' ");

Indicates that the response will display the passenger's complete itinerary.

This is only applies when a customer supplies a session ID.

req.append("DisplayItinerary='0' ");

 

req.append(">");

Enter the confirmation number (record locator).

req.append(MessageFormat.format
("<RecordLocator>{0}</RecordLocator>",
new Object [] { recloc}));

Ends the itinerary information and the confirmation number profile.

req.append("</RetrieveTrip_RQ>");

 

return Util.string2Element(req.toString());

 

}

 

 

Retrieves the itinerary.

public Element doRetrieve(Element request)

 

{

Instantiates the locator.

ItineraryServiceLocator iservice = new
ItineraryServiceLocator();

 

Element response = null;

 

try

 

{

Uses the service to get a stub, which implements the SDI.

ItineraryServiceSoapStub itin = (ItineraryServiceSoapStub)iservice.getItineraryServiceSoap(new java.net.URL(ITINERARY_URL));

The user name and password are assigned by Galileo.

itin.setUsername(USER_NAME);

itin.setPassword(PASSWORD);

 

response = itin.Itinerary(APOLLO_HAP, null, request);

 

}

 

 

Exception handling.

catch (Exception e)

{

System.err.println(e.getMessage());

e.printStackTrace(System.err);

}

return response;

}

Declares the constants. Ensure URL is specific to your region or service level.

private final String ITINERARY_URL = "https://americas.copy-webservices.travelport.com/B2BGateway/service/Itinerary";

private final String USER_NAME =
System.getProperty("USER_NAME");

private final String PASSWORD =
System.getProperty("PASSWORD");

private final String APOLLO_HAP =
System.getProperty("APOLLO_HAP");

 

}

 

 

  1. The Apollo or Galileo CRS returns the following data in a response.

Begins the Itinerary eBL response.

<RetrieveTrip_RS Version="1.0.200303102232" xmlns="http://ns.galileo.com">

Begins the description of the results of the request.

<Travel>

Begins the passenger description for the PNR/BF.

<PassengerInformation>

Begins the list of passengers in the PNR/BF.

<Passengers>

Lists the passenger's first and last name. The number is the passenger's location in the PNR/BF. (Typically, a maximum of four passengers are allowed per PNR/BF.)

<Passenger FirstName="PAM" Number="1" Surname="TEST" />

</Passengers>

The primary passenger's contact information. The telephone number attribute can have formatting characters (e.g., hyphens or periods).

The <PhoneLocationType> attribute indicates the type of telephone number:
A - Agency
B - Business
R - Residence
F - Fax
C - Cellular

The <CityAbbr> attribute is a reference only field for travel agents. There is no cross-validation with the phone area code. This element indicates only  the city associated with the telephone number.

<Telephones>

<Telephone CityAbbr="DEN" PhoneLocationType="R" PhoneNumber="000-303-1234561" />

</Telephones>

The primary passenger's address and is a required field.

The <DeliveryAddress> indicates the address where the itinerary information is sent. This field is also required, even if it is the same as the primary address.

<Addresses>

<Address>PAM TEST¤5350 S VALENCIA WAY¤GREENWOOD VILLAGE COLORADOZ/80111</Address>

<DeliveryAddress>PAM TEST¤5350 S VALENCIA WAY¤GREENWOOD VILLAGE COLORADOZ/80111</DeliveryAddress>

</Addresses>

Ends passenger description.

</PassengerInformation>

Begins the description of the flight segment of the itinerary.

<FlightItems>

The first flight segment in the itinerary.

<FlightItem SegmentNumber="1">

Lists all or some of the following details for the flight segment, including:

  • Arrival date and time

  • Departure date and time

  • Flight number

  • Arrival airport

  • Departure airport

  • Airline

  • Seating assignment

<FlightDetails ArrivalDateTime="2003-06-12T15:14:00-00:00" ChangeOfGauge="N" DepartureDateTime="2003-06-12T11:50:00-00:00" FlightFlown="N" FlightNumber="6339" MarriageNumber="" OperationalSuffix="" SellType="L" StopOverIgnore="" TicketlessIndicator="Y">

<MarketingAirline>US</MarketingAirline>

<DepartureAirport LocationCode="DEN" />

<ArrivalAirport LocationCode="ORD" />

<FlightSegment>

<BookingClass>

<Booked NumSeats="1" ResBookDesigCode="Y" Status="HK" />

</BookingClass>

</FlightSegment>

</FlightDetails>

<FlightServiceDetails>

<FlightData DepartureDate="0000-00-00" FlightNumber="" NumberOfLegs="" OperationalSuffix="" Status="">

<MarketingAirline />

</FlightData>

</FlightServiceDetails>

<SeatAssignment>

<Seat Number="" Passenger="TEST/PAM" Status="PN" />

</SeatAssignment>

Ends the description of the flight segment of the itinerary.

</FlightItem>

 

</FlightItems>

Details all the information that was encoded in the request and what the values are when decoded by Travel Codes Translator eBL.

<Decode>

 

<Airport CityCode="DEN" CityName="Denver" Code="DEN" CountryCode="US" StateProvinceCode="CO">Denver Intl Arpt</Airport>

 

<Airport CityCode="CHI" CityName="Chicago" Code="ORD" CountryCode="US" StateProvinceCode="IL">O'Hare Intl Arpt</Airport>

 

<AirlineSeatingClass Code="Y">Coach/Economy</AirlineSeatingClass>

 

<Airline Code="US">US Airways</Airline>

 

</Decode>

Details any requested segments that were not a part of the primary passenger's itinerary.

<Warnings>

 

<Text>Requested Car Info, but the PNR did not contain any Car Segments</Text>

 

<Text>Requested Hotel Info, but the PNR did not contain any Hotel Segments</Text>

 

</Warnings>

Ends the description of the results of the request.

</Travel>

Ends the Itinerary eBL response.

</RetrieveTrip_RS>

  1. The Apollo or Galileo CRS returns the following data in a response.

Begins the Itinerary eBL response.

<RetrieveTrip_RS Version="1.0.200303102232" xmlns="http://ns.galileo.com">

Begins the description of the results of the request.

<Travel>

Begins the passenger description for the PNR/BF.

<PassengerInformation>

Begins the list of passengers in the PNR/BF.

<Passengers>

Lists the passenger's first and last name. The number is the passenger's location in the PNR/BF. (Typically, a maximum of four passengers are allowed per PNR/BF.)

<Passenger FirstName="PAM" Number="1" Surname="TEST" />

</Passengers>

The primary passenger's contact information. The telephone number attribute can have formatting characters (e.g., hyphens or periods).

The <PhoneLocationType> attribute indicates the type of telephone number:
A - Agency
B - Business
R - Residence
F - Fax
C - Cellular

The <CityAbbr> attribute is a reference only field for travel agents. There is no cross-validation with the phone area code. This element indicates only  the city associated with the telephone number.

<Telephones>

<Telephone CityAbbr="DEN" PhoneLocationType="R" PhoneNumber="000-303-1234561" />

</Telephones>

The primary passenger's address and is a required field.

The <DeliveryAddress> indicates the address where the itinerary information is sent. This field is also required, even if it is the same as the primary address.

<Addresses>

<Address>PAM TEST¤5350 S VALENCIA WAY¤GREENWOOD VILLAGE COLORADOZ/80111</Address>

<DeliveryAddress>PAM TEST¤5350 S VALENCIA WAY¤GREENWOOD VILLAGE COLORADOZ/80111</DeliveryAddress>

</Addresses>

Ends passenger description.

</PassengerInformation>

Begins the description of the flight segment of the itinerary.

<FlightItems>

The first flight segment in the itinerary.

<FlightItem SegmentNumber="1">

Lists all or some of the following details for the flight segment, including:

  • Arrival date and time

  • Departure date and time

  • Flight number

  • Arrival airport

  • Departure airport

  • Airline

  • Seating assignment

<FlightDetails ArrivalDateTime="2003-06-12T15:14:00-00:00" ChangeOfGauge="N" DepartureDateTime="2003-06-12T11:50:00-00:00" FlightFlown="N" FlightNumber="6339" MarriageNumber="" OperationalSuffix="" SellType="L" StopOverIgnore="" TicketlessIndicator="Y">

<MarketingAirline>US</MarketingAirline>

<DepartureAirport LocationCode="DEN" />

<ArrivalAirport LocationCode="ORD" />

 

<FlightSegment>

 

<BookingClass>

 

<Booked NumSeats="1" ResBookDesigCode="Y" Status="HK" />

 

</BookingClass>

 

</FlightSegment>

 

</FlightDetails>

 

<FlightServiceDetails>

 

<FlightData DepartureDate="0000-00-00" FlightNumber="" NumberOfLegs="" OperationalSuffix="" Status="">

 

<MarketingAirline />

 

</FlightData>

 

</FlightServiceDetails>

 

<SeatAssignment>

 

<Seat Number="" Passenger="TEST/PAM" Status="PN" />

 

</SeatAssignment>

Ends the description of the flight segment of the itinerary.

</FlightItem>

 

</FlightItems>

Details all the information that was encoded in the request and what the values are when decoded by Travel Codes Translator eBL.

<Decode>

 

<Airport CityCode="DEN" CityName="Denver" Code="DEN" CountryCode="US" StateProvinceCode="CO">Denver Intl Arpt</Airport>

 

<Airport CityCode="CHI" CityName="Chicago" Code="ORD" CountryCode="US" StateProvinceCode="IL">O'Hare Intl Arpt</Airport>

 

<AirlineSeatingClass Code="Y">Coach/Economy</AirlineSeatingClass>

 

<Airline Code="US">US Airways</Airline>

 

</Decode>

Details any requested segments that were not a part of the primary passenger's itinerary.

<Warnings>

 

<Text>Requested Car Info, but the PNR did not contain any Car Segments</Text>

 

<Text>Requested Hotel Info, but the PNR did not contain any Hotel Segments</Text>

 

</Warnings>

Ends the description of the results of the request.

</Travel>

Ends the Itinerary eBL response.

</RetrieveTrip_RS>