Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Automate web service testing, Part 3: Test a secured web service with IBM Rational Software Architect and XMLUnit

Mansoor Ahmed, Software Engineer, IBM
Mansoor Ahmed photo
Mansoor Ahmed is a software engineer with IBM India Software Labs, Bangalore. He is currently working on WebSphere Messaging and Data Services, a telecom product, and has expertise in Web services and open source development.
Mohan Jadhav (mohan.jadhav@in.ibm.com), Staff Software Engineer, IBM
Mohan Jadhav photo
Mohan K Jadhav is a staff software engineer with IBM India Software Labs, Bangalore. He is currently working on RFID offerings from IBM and has expertise in automation testing and design.

Summary:  This tutorial introduces the technique of automating the testing of a typical web service using several technologies, including JUnit, Apache Commons HttpClient, and Apache XMLUnit. The technique is demonstrated on the development platform that IBM Rational® Software Architect offers. 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.

View more content in this series

Date:  19 Jul 2007
Level:  Advanced PDF:  A4 and Letter (722 KB | 16 pages)Get Adobe® Reader®

Activity:  16956 views
Comments:  

Before you start

About this series

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:

  1. Generate the client or skeleton code for the web service.
  2. Define the test inputs.
  3. Invoke the web service using the client or skeleton code.
  4. 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.

About this tutorial

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.


Objectives

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

Prerequisites

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.


System requirements

  • 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.

1 of 8 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=SOA and Web services, Rational
ArticleID=241239
TutorialTitle=Automate web service testing, Part 3: Test a secured web service with IBM Rational Software Architect and XMLUnit
publish-date=07192007
author1-email=manahmed@in.ibm.com
author1-email-cc=
author2-email=mohan.jadhav@in.ibm.com
author2-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.