Service-Oriented Architecture (SOA) is a design pattern in software development where different components (or services) of an application are distributed and communicate over a network. Each service is designed to perform a specific task or function and is independent of other services. These services are loosely coupled and can interact with each other through well-defined interfaces.
In SOA, the system is divided into small, independent services that can communicate with each other through a standard communication protocol. This approach makes it easier to scale, maintain, and integrate different components of an application or even external applications, while providing flexibility and reusability.
In SOA, web services play a key role as the medium for communication between distributed systems, allowing for communication over a network.
SOAP is a protocol used in SOA to enable communication between web services. It is a messaging protocol that allows for the exchange of structured information in a platform-independent and language-neutral manner. SOAP relies on XML (eXtensible Markup Language) to define the message format, making it extensible and highly standardized for various operations.
A SOAP message consists of the following parts:
Example of a simple SOAP message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://www.example.com/webservice">
<soapenv:Header/>
<soapenv:Body>
<web:GetUserDetails>
<web:UserId>12345</web:UserId>
</web:GetUserDetails>
</soapenv:Body>
</soapenv:Envelope>
In this example:
GetUserDetails, with a UserId parameter.WSDL is an XML-based language used to describe the functionality offered by a web service. It provides a detailed blueprint of how to interact with the service, what operations it supports, the data types it uses, and the protocols it supports for communication.
WSDL acts as a contract between the service provider (the server hosting the web service) and the client, ensuring that both parties understand the structure and behavior of the service.
A typical WSDL document has several key elements:
<definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://www.example.com/webservice"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="UserService" targetNamespace="http://www.example.com/webservice">
<types>
<xsd:schema targetNamespace="http://www.example.com/webservice">
<xsd:element name="GetUserDetailsRequest" type="xsd:string"/>
<xsd:element name="GetUserDetailsResponse" type="xsd:string"/>
</xsd:schema>
</types>
<message name="GetUserDetailsRequest">
<part name="userId" element="xsd:string"/>
</message>
<message name="GetUserDetailsResponse">
<part name="userDetails" element="xsd:string"/>
</message>
<portType name="UserServicePortType">
<operation name="GetUserDetails">
<input message="tns:GetUserDetailsRequest"/>
<output message="tns:GetUserDetailsResponse"/>
</operation>
</portType>
<binding name="UserServiceBinding" type="tns:UserServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetUserDetails">
<soap:operation soapAction="http://www.example.com/webservice/GetUserDetails"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="UserService">
<port name="UserServicePort" binding="tns:UserServiceBinding">
<soap:address location="http://www.example.com/webservice"/>
</port>
</service>
</definitions>
In this example:
GetUserDetails operation.GetUserDetails, and its input/output messages.In the context of a SOAP-based web service, WSDL plays an important role by describing the operations the service provides, the input and output formats, and the communication protocol (like SOAP). The client application uses the WSDL document to understand how to interact with the service and generate the necessary code to make SOAP calls.
By using SOAP and WSDL together, service providers and consumers can ensure seamless communication, regardless of the technologies and platforms involved.
Open this section to load past papers