Before you start
Web services are increasingly becoming key components in business applications. With the emergence of paradigms such as Service-Oriented Architecture (SOA), the focus on web services continues to grow. In these service-oriented and service-critical applications, web service testing assumes equal significance. Rapid creation and deployment of complex web services offer challenges to the QA team. Automating web service testing can help the team manage the effort efficiently.
Web service testing typically includes the following tasks:
- Generate the client or skeleton code for the web service.
- Define the test inputs.
- Invoke the web service using the client or skeleton code.
- Verify that the actual response is similar to that of the expected response.
Of those activities, client or skeleton code generation and response verification require the most effort.
Various tools are available to generate the client or skeleton code for a web service based on its WSDL file; however, the code generated might be proprietary and might need to be regenerated each time the WSDL changes. One solution to this problem is to eliminate the generation of the client or skeleton code and invoke the web service directly through a generic HTTP client. Later in the series, you will see one such toolkit provided by Apache Commons HttpClient (hereafter referred to as HttpClient) API.
Similarly, response verification usually involves some manual intervention, depending on the complexity of the response content. If the response contains simple elements, verification can be simple, because it requires you to just verify the value in the simple element. For responses that contain complex elements and a large list of such complex elements, manual verification can require much more effort.
This series introduces you to a technique to automate the testing of a typical web service using several technologies, including JUnit, HttpClient, and Apache XMLUnit (hereafter referred to as XMLUnit). The technique is demonstrated on the development platform that IBM Rational Software Architect offers.
This series has three parts so far:
- Part 1 demonstrates how to create a simple web service with IBM Rational Software Architect.
- Part 2 introduces the XMLUnit, which offers the API to compare two files in XML form.
- This Part 3 describes the steps to test a secured web service using HttpClient and XMLUnit, which were introduced in Part 2.
The tutorial addresses testers and developers who are interested in functional testing of a web service. Before you begin, you need a basic understanding of web services and Java development, and you should have had some exposure to unit testing tools, such as JUnit.
In this tutorial, you will learn how to:
- Define security on a web service
- Configure security on WebSphere® Application Server
- Verify security on the web service
- Test the web service using HttpClient and XMLUnit
Before you begin, you need a basic understanding of web services and Java development, and you should have had some exposure to unit testing tools, such as JUnit.
- Windows® 98, Windows XP, Windows 2000, or Windows 2003
- IBM Rational Software Architect, version 6.x
- Apache JUnit, version 3.8.1
- Apache Commons HttpClient, version 3.0.1
- Apache Commons Codec, version 1.3
- Apache XMLUnit, version 1.0
Refer to the Resources section to download versions of this software.



