Working with WSDLs

What is a WSDL?

WSDL, or Web Service Description Language, is an XML based definition language. It’s used for describing the functionality of a SOAP based web service.

WSDL files are central to testing SOAP-based services. SoapUI uses WSDL files to generate test requests, assertions and mock services. WSDL files define various aspects of SOAP messages:

  • Whether any element or attribute is allowed to appear multiple times
  • The required or optional elements and attributes
  • A specific order of elements, if it is required

You may consider a WSDL file as a contract between the provider and the consumer of the service. SoapUI supports 1.1 version of the WSDL specification and corresponding bindings for SOAP versions 1.1 and 1.2.

This article explains how to work with WSDL files in SoapUI. If you are looking for a WSDL example, or if you want to learn about the differences between WSDL and WADL, please see SOAP vs REST.

Work with WSDLs in SoapUI

Create Project From WSDL

To take a closer look at a WSDL file, create a new project and import a sample WSDL file:

  1. In SoapUI, click Create SOAP Project or select File > New SOAP Project

    New WSDL Project

  2. In the dialog box, specify the following URL in the Initial WSDL field:

    http://www.webservicex.com/CurrencyConvertor.asmx?wsdl
  3. Leave the default settings and click OK

SoapUI will load the specified WSDL and parse its contents into the following object model:

New WSDL object model

A WSDL can contain any number of services (the bindings). A binding exposes an interface for the specified protocol. In the example above, the WSDL file exposes two bindings: one for SOAP 1.1 (“CurrencyConverterSoap”) and one for SOAP 1.2 (“CurrencyConverterSoap12”).

Tip: SoapUI saves the WSDL file to a cache to avoid unnecessary network requests when you work with the project. If you want SoapUI to always use a remote WSDL file, set the Cache Definition project property to False.

Cache Definitions project property

Explore WSDL

Double-click the service in the navigator to open the editor:

  • The Overview tab contains general information on the WSDL file: its URL, target namespace, etc.

    Overview tab

  • The Service Endpoint tab contains endpoints for the interface:

    Service Endpoint tab

    Besides endpoints specified in the WSDL file, you can add endpoints for the service. For each endpoint, you can specify the required authentication.

  • The WSDL Content tab provides more details on the WSDL file

    WSDL Content tab

    The left panel allows you to browse through the contents of the file. If the service contains several WSDL files, each file is shown in a separate tab.

    The toolbar contains the following options:

    Navigate to the previous section/Navigate to the next section Selects the previous/next selected item.
    Update definition from a file

    Updates the service definition by using an external WSDL file.

    Note: In ReadyAPI, you can refactor your service. Refactoring updates your test to fit the updated definition. Download ReadyAPI Trial to try out this functionality.

    Create documentation Creates HTML documentation for your service and saves it to a file.
    Export definition to a WSDL file Exports the definition to a WSDL file.
  • On the WS-I Compliance tab, you can validate your web service against the WS-I Basic Profile (see below).

Validate the WSDL against the WS-I Basic Profile

Since the initial creation of WSDL and SOAP, a multitude of standards have been created and embodied in the Web Services domain, making it hard to agree on exactly how these standards should be used in a Web Service Context. To make interoperability between different Web Service vendors easier, the Web Service Interoperability Organization (WS-I; http://www.ws-i.org) has defined the WS-I Basic Profile - a set of rules mandating how the standards should be used. SoapUI is bundled with version 1.1 of the profile. Use it to check the conformance of a WSDL file and SOAP messages.

To validate the WSDL Service:

  1. Double-click the service in the Navigator and switch to the WS-I Compliance tab

  2. Click Run to run validation

- or -

  1. Right-click the service in the Navigator

SoapUI will show the validation report:

WS-I report

To validate SOAP messages:

  1. Open a SOAP request and send it

  2. Right-click within the XML panel of the response editor and select Check WS-I Compliance

    Select WS-I Compliance

SoapUI generates the corresponding report that highlights any compliance errors for the current request/response message exchange.

Generating Code for your WSDL

There are many web service development frameworks that allow you to generate code from a WSDL file. This can be either client code that calls operations specified in a WSDL file, or stubs for implementing the service itself. SoapUI provides a graphical interface for most frameworks. To generate it:

  1. Right-click the service in the Navigator panel and select the desired framework from the Generate Code popup menu

    WSDL Service: Generation code

    For example, if you select the Apache CXF framework, you will see the following dialog:

    WSDL Service: Generate cfx code

  2. Specify the desired settings and click Generate. SoapUI will launch the corresponding command-line tool:

    WSDL Service: Cfx code generated

Note: You must specify the path to the corresponding tool on the Tools page of SoapUI Preferences.

The selected tool generates files in the specified folder:

WSDL Service: Generated files

Next Steps

Working With WSDL Coverage

Operations and Requests

Authenticating SOAP Requests

SOAP vs REST APIs: Understand The Differences

SOAP Attchements and Files