QAT Insights

Highlighting recent QAT solution releases, insights, service and industry information, upcoming events, case studies, and press releases.

Web Service Testing with soapUIPart 1 – Getting Started

September23

soapUI is a web service testing tool by eviware. I found it extremely useful for trouble-shooting, unit testing and even load testing web services. soapUI generates SOAP test requests based on WSDLs and makes it very easy to work with the actual XML. There is no messing with web service proxies (clients) or writing programs; only for complex test scenarios you may have to do a little scripting. soapUI Pro adds a lot of features to simplify those advanced tasks but I will restrict this introduction to features available in the freely available open source version.

Get started and run a simple request

This is the main code behind my little Java/Axis 1.4 web service – I’ll skip the configuration details. It is a simple method that adds two integers and returns the result:

public class Arithmetics {
    public int add(int number1, int number2) {
        return number1 + number2;
    }
}

The service is running here:

End Point http://localhost:8080/TestServices/services/Arithmetics
WSDL Location http://localhost:8080/TestServices/services/Arithmetics?wsdl

Now we tell soapUI to import the wsdl and create test requests:

  1. Open soapUI.
  2. Create a new workspace (File–>New Workspace; I named mine “Arithmetics Test”).
  3. Create a new project (Right-click the workspace and select New soapUI Project).
  4. Follow the dialog, pointing the project to the WSDL file. This binds the service definition and creates SOAP stubs for all requests.
  5. Click OK. soapUI will begin importing the service definition.WSDL Import
  6. Let’s examine what soapUI did during the imort: Expand the binding, select our method and open “Request 1″. soapUI Web Service Binding
  7. Inspect the SOAP request with question marks where our values need to go.
    soapUI Auto-Generated SOAP Request
  8. We can use this stub to run a request. You also can use the context menu to rename this request and add more stubs. Let’s replace the question mark with real values and click the “Run” button in the upper left corner: The request executes; once it is finished we can examine the results.
    soapUI Sample Request

These simple steps have helped me out many times – they are a quick way to run a request against a service, troubleshoot problems with the XML structure and test specific inputs and outputs. But soapUI can do a lot more – stay tuned!

Anke

posted under Web Services
3 Comments to

“Web Service Testing with soapUIPart 1 – Getting Started”

  1. On September 24th, 2009 at 1:40 pm GenDeveloper » Blog Archive » Web Service Testing with soapUI Says:

    [...] Part 1 of the series can be found here . [...]

  2. On October 7th, 2009 at 8:32 am QAT Insights » Blog Archive » Web Service Testing with soapUI Part 3 – Another Test Case Example Says:

    [...] you missed the first two parts of this series, you may want to check them out first here and here. Today I want to show a few more enhancements to make a test case more flexible. [...]

  3. On October 14th, 2009 at 8:32 am QAT Insights » Blog Archive » Web Service Testing with soapUI Part 4 – A Few Tips Says:

    [...] working with web services. I previously wrote about how to get started and some test case basics here, here and here. I just want to add a few more tips I that took me a little bit of trying and [...]