Running the Airline Reservations sample

You can run the Airline Reservations sample to simulate the following tasks:

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:

  1. In the Message Brokers Toolkit, switch to the Broker Application Development perspective.
  2. 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.
  3. In the Test Client click Enqueue.
  4. Click Send Message. The first input message is put on the XML_RESERVATION_IN queue.
  5. In the Test Client click Dequeue.
  6. 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>
  7. 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:
  8. Check the XMLPASSENGERTB table in the RESERVDB database. The XML_Reservation message flow has made the following changes:
  9. Open reservation2.mbtest in the Test Client, then click Enqueue
  10. Click Send Message to put the second input message on the XML_RESERVATION_IN queue.
  11. In the Test Client, click on Dequeue
  12. 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.
  13. 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:
  14. Check the XMLPASSENGERTB table in the RESERVDB database. The XML_RESERVATION message flow has made the following changes:

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:

  1. Open passengerquery1.mbtest in the Test Client and click Enqueue.
  2. Click Send Message. The first input message is put on the XML_PASSENGERQUERY_IN queue.
  3. In the Test Client, click Dequeue.
  4. 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>
  5. Open passengerquery2.mbtest in the Test Client and click Enqueue
  6. Click Send Message to put the second input message on the XML_PASSENGERQUERY_IN queue.
  7. In the Test Client, click Dequeue.
  8. 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>
  9. 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:

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:

  1. Open flightdetailsquery.mbtest in the Test Client and click Enqueue.
  2. Click Send Message to put the input message on the XML_FLIGHTQUERY_IN queue.
  3. In the Test Client, click Dequeue.
  4. 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>
  5. 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:

  1. Open cancelreservation.mbtest in the Test Client and click Enqueue.
  2. 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.
  3. Click Send Message. The input message is put on the XML_CANCELRESERVATION_IN queue.
  4. In the Test Client, click Dequeue.
  5. 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.
  6. 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:
  7. Check the XMLPASSENGERTB table in the RESERVDB database. The XML_RESERVATION message flow has made the following changes:

Back to sample home