You are on page 1of 11

KTH ROYAL INSTITUTE OF TECHNOLOGY

ID2208 - Programming Web Services


Homework 2

Group 05:
Mustafa Kamal, 871009-5491, mkamal@kth.se
Sharbel Dahlan , 930710-5933, sharbeld@kth.se

2016-02-14

Contents
1 Overview
1.1 Required Tasks . . .
1.1.1 Task 1 . . . .
1.1.2 Task 2 . . . .
1.1.3 Constraints .
1.2 Our Implementation
1.2.1 Architecture .

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

1
1
1
1
1
2
2

2 Motivation

3 How to Build and Run the Project

1 | Overview
This homework intends to provide practical experience with developing web services,
creating web services clients, and SOAP Processing.

1.1

Required Tasks

1.1.1

Task 1

We are asked to design and implement flight ticket reservation service involving the
following services:
Authorization of customers
Checking availability of a flight (including indirect itineraries)
Checking ticket price of a flight
Booking tickets
Issuing tickets (upon booking)

1.1.2

Task 2

A test client must be developed to test that each web service works.
Moreover, some SOAP messages must be extended with some header using the
@HandlerChain.

1.1.3

Constraints

Constraints of he implementation include:


Half of the services must be implemented by writing the WSDL files first, then
generating the source code, while the other half must be written in Java.
The project must be deployed to a web service container.

1. Overview

1.2

Our Implementation

To fulfill Task 1s requirements, a web service project called SkyscanWSApplication,


and containing the wanted six services, was created. As a constraint to this task, three
of the six services, which are methods of the class SkyscanWS, were created by writing
a WSDL file (and its schema) first, and then generating the Java source code, while
the rest were written starting from Java. In the end, a WSDL file and its schema was
generated for the whole Java source code (containing the six web services).
Next, to fulfill Task 2s requirements, we developed JSP-based clients to test the different
services created in Task 1, while also using the @HandlerChain to add some security
header to the SOAP messages that are exchanged by the client and server.
The architecture of the overall project is shown in the next section.

1.2.1

Architecture

Figure 1.1 shows the architecture of the project.

Figure 1.1: The architecture of the project

In the fiugre, the SkyscanWSApplication represents our web service. The web service is deployed on a Java EE Container. out of its six methods, the bookFlight(),
issueTicket(), and the login() methods were written in WSDL and then imported to
the Java project. On the other side, three JSP-based clients interact with the server to
test its service. The client sends a SOAP request message, then the server responds with
a SOAP response.
When the server is run, SOAP messages are exchanged upon the invocation of each
method. The SOAP request and response for each of the following methods are all
included in the submission of this assignment (two separate XML files for each).

login()
findFlights()
getFlightById()
bookFlight()
checkTickets()
issueTicket()

2 | Motivation
This homework provides an extensive experience on developing web services. By practicing each of WSDL, XSD, and SOAP files, as well as writing JAVA source code, we
have successfully implemented all the required parts discussed in the Overview section.
Therefore, we have met all the requirements for passing this assignment.

3 | How to Build and Run the Project


To run the project, download and extract the submitted Homework2_Mustafa_Sharbel
zipped file, then add both the SkyscanWSApplication and the SkyscanWSJSPClient
project folders to a NetBeans IDE.
Now, follow these steps, but make sure that a GlassFish server is up and running before:

1. In the Projects pane of the NetBeans IDE, the SkyscanWSApplication should


appear. Right-click on it and select Deploy, as shown in Figure 3.1.

3. How to Build and Run the Project

Figure 3.1: Deploy web service

Upon success, the Output section at the bottom should show BUILD SUCCESSFUL,
as in Figure 3.2.

Figure 3.2: Deploy successful

2. Expand both the Project and the web services folder, and you will see SkyscanWS
web service. Right-Click on it then click Test Web Service, as shown in Figure 3.3.

3. How to Build and Run the Project

Figure 3.3: Test Web Service

Then, the web Server should run, as shown in Figure 3.4

Figure 3.4: After clicking Test Web Service, this should appear (fields would initially
be empty).

3. How to Build and Run the Project

3. To test one of the methods, like the login, entering the login credentials that were
shown in Figure 3.4, and the login method invocation takes place, with the screen
in Figure 3.5 showing. Notice the SOAP Request and Response messages being
displayed as well.

Figure 3.5: After invoking the login method with successful user authentication/authorization.

4. To test the client, go back to NetBeans, right-click on the SkyscanWSJSPClient


and then click Run, as in Figure 3.6:

3. How to Build and Run the Project

Figure 3.6: Running the Client

Then, the screen from the browser will open, showing the login from the client side,
as shown in Figure 3.7

Figure 3.7: The login screen from the running client

Then, the rest of the web services can be tested from the clients side, by logging
in through either of the model users sharbel or kamal and a model password
123, then checking the flights, booking a ticket, entering the credit card number

3. How to Build and Run the Project

to buy it, and getting the confirmed ticket screen. You will find screens similar to
the ones in Figures 3.8 through 3.11.

Figure 3.8: Test Flights

Figure 3.9: Available Flights

3. How to Build and Run the Project

Figure 3.10: Enter Credit Card Number

Figure 3.11: Ticket purchased

You might also like