Running the Airline Reservations sample
You can run the Airline Reservations sample to simulate the following tasks:
- Reserving seats on a flight
- Requesting information about a passenger
- Requesting information about a specific flight and its passenger list
- Cancelling a reservation
For each task, you put a message on a particular WebSphere MQ queue. The appropriate message flow gets the message from the queue and processes the message. The following instructions describe how to put the supplied self-defining XML messages through the Airline Reservations sample message flows and what output you can expect to receive from the message flows. Because the message flows update databases, you must run the message flows in the order that they are listed in the following instructions.
When you run the sample, you might see error messages similar to Unresolvable database table reference T.CLASSTYPE in the Problems view of the Message Brokers Toolkit. This warning indicates that definitions for the database tables have not been imported into the project. This does not affect the behaviour of the sample at run time.
How you view the contents of the sample's database depends on which database product is installed. For DB2 databases use the tools provided by DB2; for example, the DB2 Control Center. If you have not installed a database product, the samples use the Apache Derby database. For instructions on how to view the data in a Derby database see Viewing the contents of a Derby database.
If you have any problems when you run the sample, see Diagnosing problems.
1. Running the XML_Reservation message flow
The XML_Reservation message flow reserves seats on the flight listed in the
input message and generates reply messages for the passengers to confirm their
reservations.
To run the XML_Reservation message flow:
- In the Message Brokers Toolkit, switch to the Broker Application Development perspective.
- In the Broker Development view, expand the Airline XML Message Flows project, then double-click the reservation1.mbtest file to open it in the Test Client.
- In the Test Client click Enqueue.
- Click Send Message. The first input message is put on the XML_RESERVATION_IN queue.
- In the Test Client click Dequeue.
- Click Get Message to read a message from the queue. Repeat to get the four messages from the XML_RESERVATION_OUT queue.
Each reply message confirms one passenger's reservation and
contains the passenger's full name, the class of seat they have reserved,
and their unique reservation number.
The following example shows the format of a reply message:
<PassengerReservationResponse>
<ListOfConfirmations>
<Confirmation>
<FirstName>Mary</FirstName>
<LastName>Smith</LastName>
<Class>F</Class>
<ReservationNumber>CA937200305251</ReservationNumber>
</Confirmation>
</ListOfConfirmations>
</PassengerReservationResponse>
- Check the XMLFLIGHTTB table in the RESERVDB database.
In all the rows, the value in RESERVATIONSEQNO has increased by four. In the
row for flight CA937 on May 25th 2003 the XML_Reservation message flow has
made the following changes:
- Increased by two the value in ECONOMICCLASS
- Increased by two the value in FIRSTCLASS
- Decreased by two the value in TOTALECONOMIC
- Decreased by two the value in TOTALFIRST
- Check the XMLPASSENGERTB table in the RESERVDB database. The XML_Reservation
message flow has made the following changes:
- Added four new rows to the XMLPASSENGERTB table, one for each person
listed in the input message
- Allocated a unique reservation number to each reservation
- Open reservation2.mbtest in the Test Client, then click Enqueue
- Click Send Message to put the second input
message on the XML_RESERVATION_IN queue.
- In the Test Client, click on Dequeue
- Click on Get Message to get one reply message from the
XML_RESERVATION_OUT queue.
The reply message confirms Mary Smith's second reservation, and
contains her full name, the class of seat she has reserved, and her
unique reservation number. The structure of the reply message is the
same as for the replies to the first input message.
- Check the XMLFLIGHTTB table in the RESERVDB database.
In all the rows, the value in RESERVATIONSEQNO has increased by one. In the
row for flight BA039 on May 25th 2003 the XML_Reservation message flow has
made the following changes:
- Increased by one the value in FIRSTCLASS
- Decreased by one the value in TOTALFIRST
- Check the XMLPASSENGERTB table in the RESERVDB database.
The XML_RESERVATION message flow has made the following changes:
- Added a new row to the XMLPASSENGERTB table for the person named in
the input message
- Allocated a unique reservation number to the reservation
2. Running the XML_PassengerQuery message flow
The XML_PassengerQuery message flow retrieves the reservation details of the
passenger specified in the input message. The type of information in the output
message depends on the information given in the input message.
To run the XML_PassengerQuery message flow:
- Open passengerquery1.mbtest in the Test Client and click Enqueue.
- Click Send Message. The first input message is put on the XML_PASSENGERQUERY_IN
queue.
- In the Test Client, click Dequeue.
- Click Get Message to get one output message from
the XML_PASSENGERQUERY_OUT queue. The output message contains the name
and reservation details of Debra Weiss who was allocated the
reservation number that is specified in the input message. The
following example shows the format of the output message:
<PassengerInfoResponse>
<PassengerInfo>
<ReservationNumber>CA937200305253</ReservationNumber>
<FirstName>Debra</FirstName>
<LastName>Weiss</LastName>
<FlightNumber>CA937</FlightNumber>
<Date>20030525</Date>
<Class>Y</Class>
</PassengerInfo>
<PassengerInfoResponse>
- Open passengerquery2.mbtest in the Test Client and click Enqueue
- Click Send Message to put the second input message on the XML_PASSENGERQUERY_IN
queue.
- In the Test Client, click Dequeue.
- Click Get Message to get one output message from the XML_PASSENGERQUERY_OUT queue. The output
message contains the name and reservation details of both reservations made
by Mary Smith, the passenger specified in the input message. The following example shows the format of the output message:
<PassengerInfoResponse>
<ListOfReservations>
<Reservation>
<FlightNumber>CA937</FlightNumber>
<Date>20030525</Date>
<Class>F</Class>
</Reservation>
<Reservation>
<FlightNumber>BA039</FlightNumber>
<Date>20030525</Date>
<Class>F</Class>
</Reservation>
</ListOfReservations>
</PassengerInfoResponse>
- Check the RESERVDB database to see that the XML_PassengerQuery message
flow has not modified any of the data.
3. Running the XML_FlightQuery message flows
The XML_FlightQuery message flow is constructed from three small message flows.
All three message flows must be deployed to the broker and started for XML_FlightQuery
to work:
- XML_FlightQueryOut
- XML_FlightQueryReply
- XML_FlightQueryIn
The XML_FlightQuery message flow retrieves information about the flight specified
in the input message, and a list of passengers who have booked reservations
on that flight.
To run the XML_FlightQuery message flow:
- Open flightdetailsquery.mbtest in the Test Client and click Enqueue.
- Click Send Message to put the input message on the XML_FLIGHTQUERY_IN
queue.
- In the Test Client, click Dequeue.
- Click Get Message to get one output message from the XML_FLIGHTQUERY_OUT queue. The reply message
contains details of how many seats there are in First Class and Economy Class,
the cost of the seats, and how many seats are available. The following example shows the format of the reply message:
<FlightDetailsInfoResponse>
<Flight number="CA937" Flightdate="20030525">
<FirstClass>
<Capacity>38</Capacity>
<Used>6</Used>
<Price>300</Price>
</FirstClass>
<EconomyClass>
<Capacity>188</Capacity>
<Used>6</Used>
<Price>200</Price>
</EconomyClass>
<Origin>BEIJING</Origin>
<Destination>LONDON</Destination>
</Flight>
<ListOfPassengers>
<Passenger>
<ReservationNumber>CA937200305251</ReservationNumber>
<FirstName>Mary</FirstName>
<LastName>Smith</LastName>
<Class>F</Class>
</Passenger>
<Passenger>
<ReservationNumber>CA937200305252</ReservationNumber>
<FirstName>Diane</FirstName>
<LastName>Rose</LastName>
<Class>Y</Class>
</Passenger>
<Passenger>
<ReservationNumber>CA937200305253</ReservationNumber>
<FirstName>Debra</FirstName>
<LastName>Wiess</LastName>
<Class>Y</Class>
</Passenger>
<Passenger>
<ReservationNumber>CA937200305254</ReservationNumber>
<FirstName>Atila</FirstName>
<LastName>Wiess</LastName>
<Class>F</Class>
</Passenger>
</ListOfPassengers>
</FlightDetailsInfoResponse>
- Check the RESERVDB database to see that the XML_PassengerQuery message
flow has not modified any of the data.
4. Running the XML_CancelReservation message flow
The XML_CancelReservation message flow cancels the reservations that are listed,
by their reservation number, in the input message.
To run the XML_CancelReservation message flow:
- Open cancelreservation.mbtest in the Test Client and click Enqueue.
- Check the RESERVDB user database to ensure that the reservation numbers
in cancelreservation.mbtest exist in the XMLPASSENGERTB table. If the reservation
numbers do not exist in cancelreservation.mbtest, edit the Message data field.
- Click Send Message. The input message is put on the XML_CANCELRESERVATION_IN queue.
- In the Test Client, click Dequeue.
- Click Get Message to get one output message from the XML_CANCELRESERVATION_OUT queue. The output
message is just a copy of the input message.
- Check the XMLFLIGHTTB table in the RESERVDB database. In the row for flight
CA937 on May 25th 2003, the XML_CancelReservation message flow has made the
following changes:
- Decreased by two the value in ECONOMICCLASS
- Decreased by two the value in FIRSTCLASS
- Increased by two the value in TOTALECONOMIC
- Increased by two the value in TOTALFIRST
- Check the XMLPASSENGERTB table in the RESERVDB database. The XML_RESERVATION
message flow has made the following changes:
- Removed four rows to the XMLPASSENGERTB table, one for each person listed
in the input message.
Back to sample home