Let:
A: Train Booking WS that handles the train searching and reservation requests.
B: Train Filtering WS that finds and updates available trains based on departure and arrival stations, outbound and return dates and time, number of tickets and the travel class (First, Business or Standard) (see the figure below).
Each train has information about: departure and return stations, date and time, number of available seats and classes (First, Business or Standard).
A customer (client) sends a request to the SOAP service A to check available trains.
Based on the Client request (input information), service A calls the REST service B to filter trains:
client Input: departure and arrival stations, outbound and return dates and time, number of tickets and the travel class (First, Premium or Standard);
client Output: list of available trains (with train IDs) that match the user's request, as well as corresponding fares w.r.t ticket type (flexible, not flexible); or the exception: “No available trains.”.
Based on the obtained list of trains, the client chooses the outbound and the return trains (for a round trip) to make the reservation by providing their IDs. The client may also choose a one-way trip by providing one train ID.
Having the trains IDs, the service A calls service B to update the reservation information. If the reservation is successful, service B will return a value “true”. Otherwise (e.g. the ID is not corresponding to an available train) it returns a value “false”.
client Input: trains' IDs, travel class (First, Business or Standard) and ticket type (flexible, not flexible);;
client Output: a message: “Successful reservation” (if If service A receives a “true”) or a message: “Reservation error or the train”+ID+“ is not available” (otherwise).
Finally, if the client makes another search, the service B should return the result with the updated information about the previous reservation.
Recommendation: for the REST service B, add the jar files “org.restlet.jar” and “org.restlet.ext.servlet-2.1.1.jar” to the project webContent > WEB-INF > lib