Web Services Testing with SOAP UI
SOAP has not gone away. Banking, insurance, telecom and government systems still run on it, and SOAP UI is still how most testers work with them.
In this article
- SOAP and REST, in the terms a tester needs
- Starting from the WSDL
- Assertions that are worth having
- Property transfer: chaining one call into the next
- Data-driven runs and the command line
- What testers get wrong with SOAP
SOAP and REST, in the terms a tester needs
| SOAP | REST | |
|---|---|---|
| Contract | WSDL – machine readable, strict | OpenAPI, if you are lucky |
| Format | XML only | Usually JSON |
| Errors | SOAP Fault inside a 200 response | HTTP status codes |
| Transport | Usually HTTP, but not only | HTTP |
| Security | WS-Security headers | Bearer tokens, API keys, OAuth |
A SOAP service can return HTTP 200 with a Fault inside the body. Asserting on the status code alone will mark a failed call as a pass.
Starting from the WSDL
File → New SOAP Project, paste the WSDL URL, and SOAP UI generates a request skeleton for every operation. Read the WSDL before you test: it tells you the operations, the types, which elements are mandatory, and the bounds on each one. That is your test design document, free.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ban="http://example.test/banking">
<soapenv:Header/>
<soapenv:Body>
<ban:GetBalance>
<ban:accountNumber>${#TestCase#account}</ban:accountNumber>
</ban:GetBalance>
</soapenv:Body>
</soapenv:Envelope>
Assertions that are worth having
- Not SOAP Fault – the first assertion on every request.
- Schema Compliance – validates the response against the WSDL. This is the one SOAP gives you that REST usually cannot.
- XPath Match – assert on a specific element, not on the whole body.
- Contains / Not Contains – quick, but weak; use XPath where you can.
- Response SLA – fails the step if it took longer than the limit you set.
// XPath Match assertion declare namespace ban='http://example.test/banking'; //ban:GetBalanceResponse/ban:balance Expected result: 15250.00
Property transfer: chaining one call into the next
Most real tests are a sequence – open an account, deposit, check the balance. A Property Transfer step moves a value from one response into the next request:
Source : CreateAccount - Response
Path : declare namespace ban='http://example.test/banking';
//ban:CreateAccountResponse/ban:accountNumber
Target : GetBalance - Request
Path : declare namespace ban='http://example.test/banking';
//ban:GetBalance/ban:accountNumber
Data-driven runs and the command line
A DataSource step (Excel, CSV or JDBC) with a DataSource Loop turns one test case into a table of cases. Then run the suite headless so it belongs in a pipeline:
testrunner.sh -s"Banking TestSuite" -c"Balance TestCase"
-f/reports -I -r -a banking-soapui-project.xml
# -f report folder -I do not stop on an error -r print a summary
# -a export all results, not just failures
What testers get wrong with SOAP
- Asserting only on HTTP 200 and missing the Fault inside it.
- Skipping Schema Compliance, then raising a defect that the contract already forbade.
- Hard-coding an account number that exists only in one environment.
- Ignoring the WS-Security header until the first run on a secured endpoint fails.
- Testing only the happy path, when the WSDL has told you every boundary to try.
Key points
- Read the WSDL first – it is a test design document you did not have to write.
- Not SOAP Fault plus Schema Compliance on every request, always.
- Chain steps with Property Transfer rather than hard-coded ids.
- testrunner puts the suite in a pipeline; a project nobody runs is not a suite.
Practise this on the free applications at jstestingacademy.co.in/qa-apps – no account needed.
