WSDL - SOAP Binding Transport and Style Attributes in WSDL
1. Introduction
In Web Services Description Language (WSDL), SOAP binding plays an important role in defining how a web service communicates with clients using the Simple Object Access Protocol (SOAP). WSDL describes the structure and functionality of a web service, while SOAP binding specifies the communication rules that clients and service providers must follow when exchanging messages.
SOAP binding defines important communication details, including the transport protocol used to send messages and the message format expected by the service. Two important attributes associated with SOAP binding are the transport attribute and the style attribute.
The transport attribute identifies the protocol used to transfer SOAP messages between the client and the web service. The style attribute determines how the SOAP message body represents the operation and its parameters. Together, these attributes help establish a consistent communication structure between different applications.
2. Understanding SOAP Binding in WSDL
SOAP binding connects the abstract operations defined in a WSDL interface to the actual SOAP communication mechanism. It explains how a client should format requests and how a web service should respond.
In WSDL 1.1, SOAP binding is commonly defined using the soap:binding element within the binding section. This element specifies the SOAP communication style and transport mechanism.
A typical SOAP binding declaration looks like this:
<binding name="StudentServiceBinding"
type="tns:StudentService">
<soap:binding
style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
</binding>
In this example:
-
nameidentifies the binding. -
typeconnects the binding to the abstract service interface. -
style="document"specifies the document-oriented SOAP message format. -
transportidentifies HTTP as the underlying transport protocol.
This binding information helps clients understand how to communicate with the service correctly.
3. Understanding the Transport Attribute
The transport attribute specifies the underlying communication protocol used to transmit SOAP messages between the client and the web service.
In WSDL 1.1, the transport attribute is commonly specified inside the soap:binding element.
For example:
<soap:binding
style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
The value http://schemas.xmlsoap.org/soap/http indicates that SOAP messages are transmitted using HTTP.
HTTP is widely used because it allows web services to communicate through standard web infrastructure, including web servers, proxies and firewalls.
The transport attribute does not define the complete network configuration. Instead, it identifies the transport mechanism associated with the SOAP binding.
Common transport mechanisms
1. HTTP Transport
HTTP is the most commonly used transport protocol for SOAP-based web services. It allows applications to exchange SOAP messages through standard HTTP requests and responses.
For example, an online shopping application may use HTTP-based SOAP communication to send order information to a payment service.
2. HTTPS Transport
HTTPS provides secure communication by using Transport Layer Security (TLS). It protects information exchanged between the client and the web service through encryption and server authentication.
For example, banking applications can use HTTPS to protect sensitive customer information during service communication.
3. Other Transport Mechanisms
SOAP can also be transmitted through other transport mechanisms, such as SMTP or message-oriented middleware. However, these require suitable protocol support and binding implementations. They are not automatically supported simply by changing the transport attribute in a WSDL document.
4. Understanding the Style Attribute
The style attribute determines how the SOAP message body represents the operation being invoked and its parameters.
In WSDL 1.1, the two commonly used SOAP styles are:
-
Document style
-
RPC style
These styles define different approaches to structuring SOAP messages.
A. Document Style
Document style treats the SOAP message body as an XML document that follows a defined XML Schema structure.
In this approach, the message contains XML elements representing the information exchanged between the client and the web service.
For example:
<soap:Body>
<GetStudentDetails>
<StudentID>101</StudentID>
</GetStudentDetails>
</soap:Body>
Here, GetStudentDetails represents the document element, while StudentID contains the information required by the service.
Document style is commonly used in enterprise applications because it supports structured XML messages and provides flexibility when exchanging complex data.
B. RPC Style
RPC stands for Remote Procedure Call. RPC style represents a SOAP message as a request to execute a particular operation on a remote server.
The SOAP message is structured around the operation name and its parameters.
For example:
<soap:Body>
<GetStudentDetails>
<StudentID>101</StudentID>
</GetStudentDetails>
</soap:Body>
Although this example looks similar to the document-style example, RPC style follows a different message structure and interpretation. The operation name identifies the procedure being called, and the child elements represent its parameters.
RPC style is useful when a web service is designed around remote procedure calls, where clients invoke specific methods on a server.
5. Difference Between Document Style and RPC Style
|
Feature |
Document Style |
RPC Style |
|---|---|---|
|
Message structure |
XML document-based |
Operation-based |
|
Main purpose |
Exchange structured XML data |
Invoke remote procedures |
|
Data representation |
Schema-defined XML elements |
Operation parameters |
|
Flexibility |
Suitable for complex XML structures |
Closely follows method invocation |
|
Common usage |
Enterprise data exchange |
Remote method execution |
Both styles allow SOAP-based communication, but they organize the message body differently.
6. How Transport and Style Attributes Work Together
The transport and style attributes perform different functions, but they work together to define SOAP communication.
The transport attribute determines how the SOAP message travels across the network, while the style attribute determines how the message body is structured.
For example, consider a student management web service that allows users to retrieve student records.
The service may use the following binding:
<binding name="StudentServiceBinding"
type="tns:StudentService">
<soap:binding
style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetStudentDetails">
<soap:operation
soapAction="GetStudentDetails"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
In this example:
-
The binding connects the service interface to its SOAP communication rules.
-
The document style defines the structure of the SOAP message body.
-
The HTTP transport specifies how messages are transmitted.
-
The SOAP operation identifies the operation being invoked.
-
The literal body indicates that the message content follows the defined XML structure rather than being encoded using SOAP encoding rules.
As a result, the client can construct an appropriate SOAP request and send it to the web service using HTTP.
7. Importance of SOAP Binding Transport and Style Attributes
SOAP binding transport and style attributes are important for several reasons.
Standardized Communication: They establish common communication rules between clients and web services, reducing differences in message interpretation.
Interoperability: They help applications developed using different programming languages and platforms communicate with one another.
Message Structure: The style attribute determines how SOAP message bodies represent operations and their associated information.
Protocol Identification: The transport attribute identifies the communication mechanism used to exchange SOAP messages.
Application Integration: They make it easier to integrate enterprise applications, databases, payment systems and other web-based services.
Security and Reliability: Selecting an appropriate transport mechanism, such as HTTPS, helps protect information exchanged between applications.
8. Real-World Applications
SOAP binding transport and style attributes are used in several practical applications.
Banking Systems: Banking applications use SOAP web services to exchange account information, transaction details and payment requests. HTTPS transport helps protect sensitive information.
Educational Management Systems: Educational institutions can use document-style SOAP services to exchange student records, examination results and admission information.
E-Commerce Applications: Online shopping platforms can communicate with inventory, billing and payment services through SOAP-based web services.
Healthcare Applications: Healthcare systems can exchange structured patient records and appointment information between different software platforms.
Enterprise Applications: Large organizations use SOAP-based services to integrate customer management, employee management and financial systems.
9. Conclusion
SOAP binding transport and style attributes are essential components of WSDL-based web service communication. The transport attribute identifies the protocol used to transmit SOAP messages, while the style attribute determines how the SOAP message body represents operations and their parameters. Document and RPC are the two commonly used SOAP styles in WSDL 1.1.
By combining appropriate transport and style configurations, developers can create standardized, interoperable and reliable web services. Understanding these attributes helps developers design SOAP-based applications that communicate effectively across different platforms and technologies.