WSDL Basics

Introduction

When teams work with REST APIs, they usually rely on OpenAPI or Swagger documentation to understand available endpoints, request formats, response formats, authentication rules, and status codes. SOAP web services use a similar contract-driven idea, but the contract is usually described through WSDL, which stands for Web Services Description Language. A WSDL document tells a client what a SOAP service offers and how the client should communicate with it.

A WSDL document describes the available operations, input messages, output messages, XML data types, namespaces, communication protocol, binding style, SOAP version, and service endpoint. Because it contains these details, WSDL is often called the contract between the SOAP service provider and the client. The provider publishes the WSDL. The client reads it, understands the operations, builds the correct SOAP request, sends the request to the correct endpoint, and expects the response structure defined by the same contract.

For API testers, WSDL is usually the starting point for SOAP testing. Before sending a SOAP request, testers need to know the operation name, request body structure, required namespaces, required elements, optional elements, data types, SOAPAction, content type, endpoint URL, and expected response structure. Most of this information comes from the WSDL and the XSD schemas referenced or embedded inside it. Testing a SOAP API without reviewing the WSDL often leads to wrong request formats, wrong namespaces, wrong endpoints, and weak validations.

This tutorial explains WSDL in a practical testing style. It covers what WSDL is, why it is needed, how it works, the WSDL workflow, the analogy of WSDL as an instruction manual, the main WSDL components, definitions, types, messages, portType, binding, service, complete hierarchy, SOAP request generation, information available in WSDL, WSDL validation, WSDL versus XSD, WSDL versus OpenAPI, REST Assured, Postman, SoapUI, real-world examples, best practices, common mistakes, and interview-ready explanations.

What Is WSDL?

WSDL, or Web Services Description Language, is an XML-based document that describes a SOAP web service and explains how clients can communicate with it. It defines what operations are available, what data must be sent, what data will be returned, which XML types are used, which protocol and message format apply, and where the service is available. In simple terms, WSDL is the formal instruction document for a SOAP service.

A simple definition is this: WSDL is an XML document that defines the operations, messages, data types, protocols, and endpoint of a SOAP web service. It is both documentation and contract. Humans can read it to understand the service, and tools can read it to generate client code, request templates, and validation models.

WSDL is especially important in enterprise SOAP services because SOAP is strongly contract-oriented. The service is not usually discovered by guessing URLs and methods the way some REST APIs are explored. Instead, the WSDL defines the operation names and message structures. A tester who can read a WSDL can understand the service more accurately and avoid many trial-and-error mistakes.

Why WSDL Is Needed

Without WSDL, clients would not know which operations are available, request and response formats would be unclear, service endpoints would be unknown, data types would be ambiguous, namespace rules would be difficult to discover, and integration would become slow and error-prone. A SOAP service may expose operations such as GetEmployee, AddEmployee, UpdateEmployee, and DeleteEmployee. Without WSDL, the client would need separate documentation or manual support from developers to know how to call them.

With WSDL, integration becomes more standardized. Tools can generate SOAP clients automatically. Testing tools can discover operations. Request templates can be generated from the contract. XML schemas can validate request and response structures. Endpoint information can be read from the service section. Binding information can clarify protocol and SOAP version. This creates better interoperability between systems built in different languages and platforms.

For testers, WSDL reduces ambiguity. It helps define expected behavior before test execution. It shows what the request should contain, what response should be expected, what data types are valid, and what schema rules apply. It also helps testers identify contract defects when the service behavior does not match the published WSDL.

WSDL Workflow

The WSDL workflow begins with the SOAP service. The service publishes or provides a WSDL document. The client reads the WSDL. A tool or developer uses the WSDL to generate a SOAP request or client code. The client sends the SOAP request to the service endpoint. The service processes the request and returns a SOAP response according to the contract.

SOAP Service
  |
  v
WSDL Document
  |
  v
Client Reads WSDL
  |
  v
Client Generates Request
  |
  v
SOAP Communication

In testing, the workflow is similar. The tester obtains the WSDL, imports it into a tool such as SoapUI, inspects available operations, reviews request templates, checks namespaces and schemas, sends valid and invalid requests, validates responses, and verifies fault behavior. Automation engineers may use the WSDL and schemas to create reusable request templates and validation utilities.

This workflow makes WSDL the entry point for SOAP API testing. If the WSDL is inaccessible, outdated, or inconsistent with the service implementation, testing becomes harder and integration risk increases. WSDL quality is therefore part of API quality.

WSDL Analogy

Think of a WSDL as the instruction manual for a SOAP web service. It tells clients what operations are available, what data to send, what data will be returned, where to send the request, which protocol to use, which namespaces apply, and how the messages are structured. Just as a user manual tells someone how to operate a device correctly, WSDL tells a client how to call a SOAP service correctly.

This analogy is useful for beginners because WSDL can look intimidating at first. It is XML, it may contain namespaces, it may include schemas, and it may have many sections. But each section has a purpose. Types define data. Messages define request and response parts. PortType defines operations. Binding defines protocol details. Service defines the endpoint. Once these sections are understood, WSDL becomes readable.

For testers, the instruction manual mindset is practical. Before testing an operation, read what the manual says. If the manual says EmployeeId is required and must be an integer, test valid integer values and invalid non-integer values. If the manual says the service endpoint is a specific URL, confirm requests are sent there. If the manual says a binding uses SOAP 1.1, do not assume SOAP 1.2 behavior.

WSDL Structure

A WSDL document typically contains definitions, types, messages, portType, binding, and service. These parts work together to describe the full SOAP service contract. The high-level hierarchy can be represented as:

Definitions
  |
  +-- Types
  +-- Messages
  +-- PortType
  +-- Binding
  +-- Service

The definitions element is the root of the WSDL. The types section defines XML data types, usually with XSD. The message section defines request and response messages. The portType section defines available operations, similar to an interface. The binding section defines protocol and message format. The service section defines where the service endpoint is located.

Understanding this structure helps testers know where to look. If you need the endpoint URL, check the service section. If you need operation names, check portType. If you need request and response message names, check message definitions. If you need required elements and data types, check the types section and associated XSD.

Main Components of WSDL

Component Purpose
Definitions Root element of the WSDL document.
Types Defines XML data types using XSD.
Message Defines request and response messages.
PortType Defines available operations.
Binding Specifies communication protocol, SOAP version, and message format.
Service Specifies the actual service endpoint URL.

These components should be read together. A message definition alone does not tell you where to send a request. A service endpoint alone does not tell you what XML body to send. A binding alone does not tell you which business operations exist. The WSDL contract becomes meaningful when these parts are connected.

Definitions

The definitions element is the root element of every WSDL document. It contains all other WSDL components and usually declares namespaces used throughout the document.

<definitions
  xmlns="http://schemas.xmlsoap.org/wsdl/">
</definitions>

In real WSDL files, the definitions element may include multiple namespace declarations, a target namespace, service names, and references to SOAP and XML Schema namespaces. Because WSDL itself is XML, namespace handling is important. A tester does not always need to memorize every namespace declaration, but should recognize that they affect how operations, messages, and schema types are resolved.

When a WSDL is invalid or badly formed, tools may fail to import it. If SoapUI or a client generator cannot read the WSDL, the issue may be malformed XML, inaccessible imported schemas, wrong namespace declarations, or an incomplete contract. That is a valid API documentation or contract defect.

Types

The types section defines the XML data types used by the SOAP service. It usually contains XML Schema definitions. These schemas define elements, complex types, simple types, required fields, optional fields, data types, enumerations, occurrence rules, and validation constraints.

<types>
  <xsd:schema>
    ...
  </xsd:schema>
</types>

For testers, the types section is one of the most important parts of WSDL because it defines what valid request and response XML should look like. If a request requires EmployeeId as an integer, that rule is usually found in the schema. If a field is optional, the schema may define minOccurs="0". If a value must be one of several allowed statuses, the schema may use enumeration.

Testing should include both positive and negative cases based on the types section. Valid values should pass. Missing required elements should fail. Wrong data types should fail. Invalid enumerations should fail. Wrong element order should fail when sequence rules apply. This makes WSDL and XSD analysis a direct input into test case design.

Message

The message section defines the structure of request and response messages. A request message may describe what input parts the operation needs. A response message may describe what output parts the operation returns.

<message name="GetEmployeeRequest">
  <part name="EmployeeId" type="xsd:int"/>
</message>

A response message may refer to an element defined in the schema:

<message name="GetEmployeeResponse">
  <part name="Employee" element="tns:Employee"/>
</message>

Messages help connect operations to XML payload structures. In document-style SOAP services, message parts often reference schema elements. In older RPC-style services, message parts may reference types more directly. Testers should understand the request and response messages for each operation they test because those messages define the expected payload contract.

PortType

The portType section defines the operations offered by the web service. It is comparable to an interface in Java because it tells clients what operations exist without necessarily defining every transport detail. A simple portType may look like this:

<portType name="EmployeePortType">
  <operation name="GetEmployee">
  </operation>
</portType>

Operations may include GetEmployee, AddEmployee, UpdateEmployee, DeleteEmployee, TransferFunds, CheckBalance, SubmitClaim, GetPatient, or CreatePolicy depending on the domain. Each operation is associated with input and output messages. The operation name is central to SOAP request generation and response validation.

For testers, portType is where the list of testable service actions becomes visible. If an operation is documented in requirements but missing from WSDL, that is a contract issue. If an operation appears in WSDL but the endpoint does not support it, that is an implementation or deployment issue. If an operation has wrong input or output message definitions, tests should catch the mismatch.

Binding

The binding section defines how the abstract operations and messages are bound to a concrete communication protocol and message format. It can define protocol, SOAP version, message style, encoding, transport, and SOAPAction information. A simplified binding may look like this:

<binding
  name="EmployeeBinding"
  type="tns:EmployeePortType">
</binding>

The binding tells the client how to communicate with the service. It may specify SOAP over HTTP, document style, literal use, SOAP action values, and other details. These details influence request headers and message format. A tester should not assume every SOAP service uses the same binding behavior.

Binding validation is important when troubleshooting. If the client uses the wrong SOAPAction, content type, SOAP version, or message style, the service may reject the request. The binding section helps identify the correct expectations.

Service

The service section defines the actual service endpoint. It tells clients where to send SOAP requests. A simplified service section may look like this:

<service name="EmployeeService">
  <port>
    <soap:address location="http://example.com/EmployeeService"/>
  </port>
</service>

The endpoint URL is one of the most practical pieces of information in the WSDL. If testers send requests to the wrong endpoint, all other request details may be correct and the test can still fail. In different environments, the endpoint may vary between QA, UAT, staging, and production. Teams should manage environment-specific endpoints carefully.

Some WSDL files expose environment-specific URLs that are not valid for every tester. Others require endpoint overrides in tools. Testers should confirm the correct environment endpoint before executing test cases, especially when working with generated clients or imported SoapUI projects.

Complete WSDL Hierarchy

The complete hierarchy of a simplified WSDL can be represented as:

<definitions>
  <types/>
  <message/>
  <portType/>
  <binding/>
  <service/>
</definitions>

This simplified view hides many details, but it helps beginners understand the order of ideas. Definitions wraps everything. Types define data. Messages define request and response structures. PortType defines operations. Binding defines communication details. Service defines endpoint location.

In real WSDL files, these sections may be longer, namespaced, imported from other files, or split across multiple XSD documents. The same core idea still applies. A WSDL is a structured service contract, and each section has a distinct job.

How SOAP Uses WSDL

SOAP clients use WSDL to understand how to create requests and consume responses. A client reads the WSDL, identifies the operation, creates the SOAP request body based on the input message and schema, sends it to the endpoint defined in the service section, and receives a response that should match the output message and schema.

Client
  |
  v
Reads WSDL
  |
  v
Creates SOAP Request
  |
  v
Calls Service
  |
  v
Receives SOAP Response

Client generation tools can use WSDL to generate code. Testing tools can use it to generate request templates. Automation frameworks can use its schemas for validation. This makes WSDL both a human-readable and machine-readable contract.

If the service implementation changes but the WSDL is not updated, clients and tests may break or become misleading. If the WSDL changes but generated client code is not regenerated, tests may use outdated structures. WSDL version management is therefore important in SOAP projects.

Information Available in WSDL

A WSDL document provides service name, operations, request messages, response messages, XML Schema, data types, endpoint URL, SOAP version, binding style, namespaces, SOAPAction values, and sometimes imported schema references. This information is enough for a client or testing tool to understand how to communicate with the service.

For testers, the most used details are operations, endpoint URL, request format, response format, required namespaces, SOAPAction, data types, required fields, optional fields, and fault structures. These details guide test design, test data preparation, request creation, response validation, and negative testing.

When a tester receives only a SOAP endpoint URL without WSDL, the first question should be whether the WSDL is available. Many SOAP services expose it using a query parameter such as:

http://example.com/EmployeeService?wsdl

Not every production service exposes WSDL publicly, but teams should provide the contract through an approved internal location if direct exposure is disabled.

WSDL in API Testing

Before testing a SOAP API, testers typically obtain the WSDL to understand available operations, required request structure, XML Schema, endpoint URL, required namespaces, SOAPAction, request format, response format, and expected faults. This analysis should happen before writing test cases and automation.

WSDL analysis helps testers identify positive scenarios, negative scenarios, boundary cases, required fields, optional fields, allowed values, invalid data types, and schema validation rules. It also helps distinguish contract failures from business failures. If the request violates XSD, the failure is a contract validation issue. If the request is valid but the account has insufficient balance, the failure is a business rule result.

Good SOAP testing often begins with importing the WSDL into a tool, generating sample requests, comparing the generated XML with documentation, executing baseline happy path calls, and then expanding into negative and boundary testing. For automation, request templates and schema validation utilities can be built from the same contract.

SOAP Request Generation

Testing tools can automatically generate SOAP requests from a WSDL. SoapUI, ReadyAPI, Eclipse Web Tools, IntelliJ IDEA, Visual Studio, and other tools can read WSDL documents, discover operations, and generate request templates. This is useful because SOAP requests can be verbose and namespace-heavy.

Generated requests are a starting point, not the final test strategy. Testers should review generated XML, fill required values, remove irrelevant placeholder values, add required headers, configure endpoints, and validate responses. Generated templates help avoid structural mistakes, but testers still need to understand what the request means.

Automation teams may store generated request XML as templates, then parameterize values such as employee id, account number, claim id, or transaction amount. This keeps SOAP test code readable while preserving the full request structure.

WSDL Validation in API Testing

QA engineers should verify that the WSDL is accessible, operations exist, messages are correctly defined, XML Schema is valid, binding is correct, endpoint URL is correct, SOAP version is correct, namespaces are valid, and generated requests work as expected. WSDL validation is partly a documentation check and partly a contract check.

If the WSDL cannot be imported into standard tools, that is a problem worth investigating. If imported schemas are missing, invalid, or blocked by environment configuration, client generation may fail. If operation definitions do not match actual service behavior, the published contract is unreliable. If endpoint URLs point to the wrong environment, testers may accidentally call the wrong service.

Response validation should also compare actual responses with the WSDL and XSD contract. If the WSDL says an operation returns a specific response element and the service returns a different element, that mismatch should be reported. If schema validation fails for a response from the service itself, that is a serious provider-side contract defect.

WSDL vs XSD

WSDL XSD
Describes the complete SOAP web service. Describes XML structure and data types.
Defines operations. Defines elements and data types.
Includes endpoint and binding information. Does not define service endpoint information.
Uses XSD internally or references it. Can be used inside WSDL or separately.

The relationship is simple: WSDL describes the service; XSD describes the XML data used by the service. A WSDL may contain or reference XSD schemas. Testers need both views. WSDL tells what operation to call and where. XSD tells what XML structure is valid.

WSDL vs OpenAPI

WSDL OpenAPI
Used mainly for SOAP services. Used mainly for REST APIs.
Written in XML. Usually written in JSON or YAML.
Describes operations and SOAP messages. Describes endpoints, methods, requests, and responses.
Uses XML Schema. Uses schema definitions commonly aligned with JSON payloads.

WSDL and OpenAPI serve similar contract purposes for different API styles. WSDL fits SOAP, XML, operations, bindings, and service endpoints. OpenAPI fits REST, resources, HTTP methods, status codes, and JSON-style schemas. Testers who understand both can work across legacy and modern API systems.

REST Assured and WSDL

REST Assured does not automatically read WSDL files. SOAP requests are typically created manually, stored as XML templates, or generated using external tools and then sent as XML over HTTP. REST Assured can still test SOAP endpoints because SOAP commonly uses HTTP as the transport.

A practical REST Assured SOAP test sends the complete SOAP envelope as the request body, sets the correct content type, adds SOAPAction if required, posts to the service endpoint, and validates the response status and XML body. XSD validation can be added using Java XML validation libraries.

The WSDL remains useful even if REST Assured does not import it directly. Testers use WSDL to build correct request templates, know the endpoint, understand SOAPAction, validate namespaces, and derive expected response structures.

Postman and WSDL

Postman does not directly import WSDL files in the same way SoapUI does. Typically, testers obtain the WSDL, understand the SOAP operation and request structure, build the SOAP XML request manually, set the appropriate headers, and send the request using POST. The response can then be inspected and validated with Postman tests or manual review.

Postman is useful when testers want lightweight request execution, quick debugging, or sharing examples. However, for WSDL-heavy SOAP work, a dedicated SOAP tool may be more efficient because it can generate operation templates automatically from the WSDL.

SoapUI and WSDL

SoapUI can import a WSDL and automatically discover operations, generate request templates, generate sample SOAP messages, display XML Schema, and simplify SOAP API testing. This is why SoapUI is widely used in SOAP projects. It understands the WSDL contract and turns it into testable request structures.

After importing a WSDL, testers can inspect operations, edit request values, add headers, configure endpoints, execute requests, inspect responses, and create assertions. SoapUI is especially helpful for beginners because it makes the WSDL structure visible through a user interface.

Even when using SoapUI, testers should understand WSDL concepts. Tool-generated requests are easier to trust when you know what definitions, types, messages, portTypes, bindings, and services mean. When something fails, WSDL knowledge helps diagnose whether the problem is request data, endpoint configuration, namespace, schema, SOAPAction, or service behavior.

Real-World Examples

In banking systems, a WSDL may define operations such as TransferFunds, CheckBalance, and GetStatement. The types section defines account numbers, amounts, currencies, transaction ids, and response structures. Testers validate successful transfers, insufficient balance faults, invalid account numbers, duplicate transaction ids, and schema compliance.

In healthcare systems, operations may include GetPatient, UpdatePatient, GetAppointment, SubmitClaim, or CheckEligibility. The WSDL and schemas define patient identifiers, appointment data, claim structures, provider details, and response formats. Testers validate required fields, privacy-sensitive data handling, authorization behavior, and fault responses.

In insurance systems, operations may include CreatePolicy, GetPolicy, SubmitClaim, CalculatePremium, and UpdatePolicy. In employee services, operations may include GetEmployee, AddEmployee, UpdateEmployee, and DeleteEmployee. In each case, WSDL tells testers what operations exist and how messages should be structured.

Best Practices

Always start SOAP API testing by reviewing the WSDL. Verify that all documented operations are available. Validate request and response structures against the XSD. Confirm endpoint URLs and bindings. Use tools that can generate SOAP requests from the WSDL when helpful. Keep WSDL versions synchronized with service changes. Validate namespaces and SOAP versions.

Store WSDL and related schema files in a known location for automation when allowed by the project. If service contracts change, update request templates, generated clients, and schema validations together. Avoid hard-coding environment-specific endpoint URLs in many test files. Use configuration for QA, UAT, staging, and production endpoints.

Do not rely only on generated request templates. Review the business meaning of each operation and field. Build positive tests, negative tests, boundary tests, schema validation tests, fault tests, security tests, and regression tests based on the WSDL contract and business requirements.

Common Mistakes

A common mistake is ignoring the WSDL and testing by guessing the request structure. This often leads to incorrect namespaces, missing required elements, wrong operation names, or invalid SOAPAction headers. Another mistake is using the wrong endpoint. The endpoint URL is defined in the service section of the WSDL, but teams may need environment-specific overrides.

Ignoring XSD is another serious mistake. The XML Schema inside the WSDL defines required elements, optional elements, data types, order, occurrence rules, and allowed values. Without schema awareness, tests may miss important contract defects. Assuming REST concepts apply directly to SOAP is also risky. SOAP operations are described in the WSDL rather than through REST-style resource endpoints.

Another common mistake is not updating client code or test requests when the WSDL changes. Generated clients, request templates, and automation assertions may need to be regenerated or updated. If they are not, tests may fail for the wrong reason or continue validating an outdated contract.

Interview Questions

A common interview question is: what is WSDL? A strong answer is that WSDL, or Web Services Description Language, is an XML-based document that describes a SOAP web service. It defines available operations, request and response messages, XML data types, bindings, namespaces, SOAP version, and endpoint URLs.

Another question is: what information does WSDL provide? A good answer includes operations, messages, data types, XML Schema, endpoint URL, binding, SOAP version, SOAPAction, and namespaces. These details allow clients and testers to understand how to communicate with the service.

Interviewers may ask the main components of WSDL. The common components are Definitions, Types, Message, PortType, Binding, and Service. Definitions is the root. Types defines schema. Message defines request and response messages. PortType defines operations. Binding defines protocol and message format. Service defines endpoint location.

They may also ask the difference between WSDL and XSD. WSDL describes the complete web service, while XSD defines only the XML structure and data types used by the service. WSDL often includes or references XSD.

Interview-Ready Explanation

WSDL, or Web Services Description Language, is an XML-based document that serves as the contract for a SOAP web service. It defines the service's available operations, request and response messages, XML data types, communication bindings, namespaces, SOAP version, SOAPAction details, and endpoint URLs. The main components of a WSDL are Definitions, Types, Message, PortType, Binding, and Service.

During API testing, testers use WSDL to understand how to construct SOAP requests, validate XML against associated XSD schemas, identify available operations, determine the correct service endpoint, configure required headers, and verify that the service conforms to its published contract. WSDL analysis helps testers design positive tests, negative tests, schema validation tests, and SOAP fault validation scenarios.

The key point is that WSDL is not just documentation. It is a contract. If the service does not behave according to the WSDL, consumers may fail. If tests ignore the WSDL, they may send invalid requests or miss contract defects. Strong SOAP testing begins with reading the WSDL, understanding the schema, generating or building correct requests, and validating both successful responses and fault responses against the contract.

Key Takeaway

WSDL is the contract document for SOAP web services. It describes what operations exist, what messages are exchanged, what XML data types are used, how messages are bound to a protocol, and where requests should be sent. It plays a role similar to OpenAPI for REST, but it is XML-based and designed for SOAP services.

For API testers, WSDL should be reviewed before SOAP testing begins. It provides the operation list, request and response structure, endpoint, binding, namespaces, SOAP version, and schema rules needed to build reliable tests. A practical SOAP testing approach uses WSDL for contract understanding, XSD for schema validation, tools such as SoapUI for request generation, and automation frameworks for repeatable validation of structure, faults, and business rules.