SOAP - Testing SOAP Services with SoapUI
Testing SOAP services is an essential part of web service development because it ensures that services function correctly, return accurate responses, handle errors properly, and meet performance expectations. SoapUI is one of the most widely used tools for testing SOAP web services. It provides a graphical interface that allows developers, testers, and quality assurance teams to create, execute, and automate tests without writing extensive code.
Introduction to SoapUI
SoapUI is an API testing tool specifically designed for testing SOAP and REST web services. It simplifies the process of sending requests to a web service and analyzing the responses. SoapUI supports functional testing, regression testing, load testing, security testing, and automated testing.
For SOAP services, SoapUI can automatically read a WSDL (Web Services Description Language) file and generate the available service operations. This feature eliminates the need to manually create complex XML requests.
Why SOAP Service Testing Is Important
SOAP services often handle critical business operations such as banking transactions, healthcare records, e-commerce orders, and enterprise communications. Testing helps verify:
-
Correct request and response formats
-
Proper XML structure
-
Data validation
-
Error handling mechanisms
-
Service availability
-
Security implementation
-
Performance under load
Without thorough testing, SOAP services may produce incorrect results, expose security vulnerabilities, or fail during high traffic conditions.
Installing SoapUI
The installation process generally involves:
-
Downloading SoapUI from the official website.
-
Running the installation package.
-
Selecting installation options.
-
Launching the application after installation.
SoapUI is available for Windows, Linux, and macOS platforms.
Creating a SOAP Project
The first step in testing a SOAP service is creating a project.
Steps:
-
Open SoapUI.
-
Select "New SOAP Project."
-
Enter a project name.
-
Provide the WSDL URL.
-
Click OK.
SoapUI automatically analyzes the WSDL document and imports all available operations, requests, and service definitions.
For example, if a web service contains operations such as:
-
GetCustomer
-
AddCustomer
-
UpdateCustomer
-
DeleteCustomer
SoapUI creates sample requests for each operation.
Understanding SOAP Requests
A SOAP request is an XML document sent to the server.
Example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cus="http://example.com/customer">
<soapenv:Header/>
<soapenv:Body>
<cus:GetCustomer>
<cus:CustomerID>101</cus:CustomerID>
</cus:GetCustomer>
</soapenv:Body>
</soapenv:Envelope>
The request contains:
-
Envelope
-
Header
-
Body
-
Operation details
-
Input parameters
SoapUI allows users to edit request values directly before execution.
Sending SOAP Requests
After creating the request:
-
Enter test values.
-
Click the Submit button.
-
Wait for the server response.
SoapUI sends the XML request to the web service endpoint and displays the response.
Analyzing SOAP Responses
A successful response may look like:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetCustomerResponse>
<CustomerName>John Smith</CustomerName>
<Email>[email protected]</Email>
</GetCustomerResponse>
</soap:Body>
</soap:Envelope>
The tester verifies:
-
Correct values returned
-
Expected XML structure
-
Data accuracy
-
Response status
Any mismatch indicates a potential issue in the service implementation.
Functional Testing in SoapUI
Functional testing ensures that each operation behaves according to requirements.
Examples include:
Valid Input Testing
Sending correct input values and verifying successful responses.
Invalid Input Testing
Providing incorrect or missing values.
Example:
<CustomerID></CustomerID>
The service should return a meaningful error message.
Boundary Value Testing
Testing values at the limits of accepted ranges.
For example:
-
Minimum quantity
-
Maximum quantity
-
Empty strings
-
Large data values
Data Validation Testing
Ensuring returned data matches database records or business rules.
Assertions in SoapUI
Assertions are validations performed automatically on responses.
Common assertions include:
Contains Assertion
Checks whether specific text exists in the response.
Example:
CustomerName
XPath Assertion
Verifies XML values using XPath expressions.
Example:
//CustomerName
Response Time Assertion
Ensures responses arrive within a specified time.
Example:
-
Maximum response time: 1000 milliseconds
Not Contains Assertion
Verifies that unwanted text is absent from the response.
Assertions help automate verification and reduce manual checking.
Data-Driven Testing
Data-driven testing allows the same test to run multiple times using different input values.
Example customer data:
| CustomerID |
|---|
| 101 |
| 102 |
| 103 |
| 104 |
SoapUI reads values from:
-
Excel files
-
CSV files
-
Databases
-
Properties files
This approach improves coverage and efficiency.
Test Suites and Test Cases
Test Suite
A collection of related test cases.
Example:
Customer Management Suite
Test Cases
Individual testing scenarios.
Examples:
-
Create Customer
-
Update Customer
-
Delete Customer
-
Search Customer
Organizing tests into suites simplifies maintenance and execution.
Property Transfers
Property Transfer allows data from one request or response to be reused in another test step.
Example:
-
Create Customer.
-
Receive CustomerID.
-
Use CustomerID in Update Customer request.
This creates realistic end-to-end workflow testing.
Security Testing
SOAP services often require strong security measures.
SoapUI supports testing for:
Authentication
-
Basic Authentication
-
Token Authentication
-
Certificate-based Authentication
SQL Injection Testing
Example:
' OR '1'='1
Testing ensures the service is protected against malicious input.
XML Injection Testing
Verifies proper handling of manipulated XML content.
Security Scans
SoapUI can automatically run predefined security checks against web services.
Load Testing
Load testing evaluates service performance under heavy usage.
Examples:
-
100 concurrent users
-
500 requests per minute
-
Large XML payloads
Metrics measured include:
-
Response time
-
Throughput
-
Error rate
-
Resource utilization
Load testing identifies bottlenecks before deployment.
Mock Services
SoapUI allows creation of mock services.
A mock service simulates actual service behavior when the real service is unavailable.
Benefits include:
-
Early testing during development
-
Reduced dependency on external systems
-
Faster debugging
Developers can test client applications even before the actual SOAP service is completed.
Automation Using SoapUI
SoapUI supports automated execution of tests.
Automation benefits include:
-
Faster regression testing
-
Continuous integration support
-
Reduced manual effort
-
Improved reliability
Tests can be scheduled to run automatically whenever application changes occur.
Reporting and Test Results
SoapUI generates reports containing:
-
Passed tests
-
Failed tests
-
Execution times
-
Error details
-
Test summaries
Reports help teams monitor service quality and identify defects quickly.
Best Practices for SOAP Testing with SoapUI
-
Validate both positive and negative scenarios.
-
Use assertions extensively.
-
Test boundary values and invalid inputs.
-
Organize tests into logical suites.
-
Automate repetitive test cases.
-
Perform load testing before deployment.
-
Verify security requirements thoroughly.
-
Maintain reusable test data.
-
Use mock services during development.
-
Review test reports regularly.
Conclusion
SoapUI is a powerful and widely adopted tool for testing SOAP web services. It enables testers and developers to validate functionality, automate testing processes, perform security checks, conduct load testing, and verify service reliability. By using features such as WSDL-based project creation, assertions, data-driven testing, automation, and reporting, organizations can ensure that SOAP services remain accurate, secure, and performant throughout their lifecycle.