Site icon Tutorial

Testing SOAP and WSDL API

Understanding SOAP and WSDL API Testing

This section is dedicated to Testing SOAP and WSDL API.

Testing SOAP and WSDL API: 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 define various aspects of SOAP messages-

Create Project from WSDL

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

Exploring WSDL

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

Validate the WSDL against the WS-I Basic Profile

To make interoperability between different Web Service vendors easier, the Web Service Interoperability Organization has defined the WS-I Basic Profile – a set of rules mandating how the standards should be used.

To validate the WSDL Service:

Operations

Each WSDL-based Service exposes a number of operations that each have a request and response message format. In soapUI, the operations for a Service are shown as nodes under the Service node in the project navigator:

Requests

For invoking an operation you can add any number of request objects to an operation in the navigator tree. soapUI by default creates a sample request for each operation when importing.

Double-clicking a request opens one of the more common concepts in soapUI, the request editor:

 

The editor is divided into two main panels, one for the request and one for the response.

Each editor has a number of views (shown with vertical tabs along the left side of the editor) and a number of inspectors at the bottom-


SOAP and WSDL API Testing: Request and Response Messages

Request Messages

 

Response Messages

The Response message has the following panels:


SOAP and WSDL API Testing: Authenticating SOAP Requests

Add Authorization

To add a new authorization:

Configure Authorization

To configure your authorization, use the options that are available on the Auth tab and the corresponding request properties.

 

Preemptive Authentication 

In general, preemptive authentication means that the server expects that the authorization credentials will be sent without providing the Unauthorized response. This reduces the load on the network and the server itself.

You can configure your requests to use or omit the preemptive authentication. To do that:

Manage Authorizations

To manage authorizations in the request:

Custom HTTP Headers

Creating custom HTTP headers in SoapUI is very straightforward. Switch to the Headers tab at the bottom of the request editor and add click to add a new header-

SOAP and WSDL API Testing: Property Expansion

SoapUI provides a common syntax to dynamically insert (“expand”) property values during processing. The syntax is as follows:

${[scope]propertyName[#xpath-expression]}

where scope can be one of the following literal values:

 

SOAP and WSDL API Testing: Attachments and Files

In SoapUI, you can simulate requests that transfer attachments to the tested server. SoapUI supports various technologies:

Viewing an Attachment – To view contents of a file, double-click this file in the Attachments tab.

 

Response Attachments – The response part of the editor also has the Attachments tab. It displays all attachments that the response message includes, with their corresponding names, content types, sizes, and other attributes.

 

Adding an Attachment

 

MTOM Attachments

To specify the place for the attachment contents in message payload, use the cid:nnnn syntax:

nnnn is an arbitrary identifier that you use to indicate the message part for the attachment.

To specify an MTOM attachment:

If we simulate this request, we will see the following:

SWA and swaREF Attachments

These attachments are an older mechanism of attaching files to SOAP messages.

Inline Files

One more way to include a file in a request is to “inline” it:

 

Caching Attachments

When you are adding a file to the Attachments tab, SoapUI asks you if you want to cache the file or not:

 

Message Inspectors

SoapUI Pro adds a number of WSDL Context-sensitive message inspectors that are available for both the standard XML Source editor and the Outline Editor displaying context-sensitive details for the currently selected content element.

The following inspectors are currently available:

Validating SOAP Services

When creating a functional TestCase in soapUI, a very common scenario is that you want to call some SOAP/WSDL service and validate the response to check that the correct result is returned. This is easily done once you have imported the WSDL for the service you want to test:

SOAP-specific assertions available

Make your resume stand out and become a Certified SoapUI Testing Professional. Try free practice tests here!

A great career is just a certification away. So, practice and validate your skills to become Certified SoapUI Testing Professional Now!

Go back to Tutorial

Exit mobile version