Chapter 2. The Sample Project
In this book, we follow a hands-on approach for learning web services testing with soapUI. We strongly recommend you to have your computer with you while reading the book and try out the test scenarios which will be described throughout this book.
In this chapter, we will be covering the following topics:
- Getting the project environment ready
- Designing the web services
- Implementing the web services
- Deploying the web services
As the first step of hands-on learning, we will introduce a sample project in this chapter. Our objective is to build a simple yet comprehensive project which covers the considerable amount of features related to web services testing. We will design and build a sample project with a few web services. We start from scratch, following the code-first web service development approach where we write Java classes first and then deploy them in a web service container.
Tip
There are two ways of developing web services; contract-first and code-first approaches. In a contract-first approach, the web service definition or the WSDL is created initially and the service implementation is done after that. In a code-first approach, the service implementation classes are developed at the beginning and usually the WSDL is automatically generated by the service container in which the web service is deployed. In our sample project, we will follow the second approach, code-first web service development, since it is relatively easier when creating web services from scratch.
We will not discuss any testing aspects within this chapter. Our focus is to build the foundation for the later chapters in this book, where we plan to use soapUI to test the sample project. If you think that you can move ahead with soapUI without spending time on the web services sample project, you will just use the outcome of the project, which are a set of web services.
Tip
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
If you decided to skip the sample project and just use the resulting web services, the following steps will help you to quickly deploy and use the web services with soapUI:
- Download the web services sample from http://www.PacktPub.com/support. Extract
WebServicesSample-Deliverable.zip
to your local file system. You will findHotelReservation.aar
file anddbscripts
folder at the root of the extracted folder. - Run
dbscripts/HotelReservationDBSchema.sql
on your MySQL database server to create the sample database and tables. - Modify the values of
mysql.host
,mysql.port
,mysql.username
, andmysql.password
properties inmysql.properties
file which can be found insideconf
folder ofHotelReservation.aar
. - Deploy
HotelReservation.aar
in Apache Axis2 (see Deploying web services section at the end of this chapter to find out how to deploy web services in Apache Axis2) and use it in all the soapUI tests which we will be working in the rest of the chapters. - You can refer to the
README.txt
ofWebServicesSample-Deliverable.zip
for more information about the installation procedure.