simple object access protocol (SOAP)
Welcome to the world of SOAP in cloud computing—a protocol that sounds like it could’ve starred in a bubbly sitcom! But fear not, SOAP, or Simple Object Access Protocol, isn’t about suds and foamy fun. It’s the serious superhero of communication, helping cloud services chat seamlessly. Let’s dive into the clean and witty world of SOAP!
What is SOAP?
The simple object access protocol (SOAP) is a messaging protocol that allows applications to communicate using HTTP and XML. It represents a fundamentally stateless, one-way message exchange paradigm between nodes. By combining one-way exchanges with features provided by the underlying transport protocol and/or application-specific information, SOAP can be used to create more complex interactions such as request/response, request/multiple response, etc.
The process of invoking Web services is very important, therefore the SOAP protocol is established to exchange messages between service providers and consumers. It is a structured XML message format for exchanging data in a distributed environment. It uses an underlying transport protocol (HTTP, SMTP, etc.) through binding. There are two versions of SOAP-SOAP version 1.1 and SOAP version 1.2.
There are three main types of SOAP nodes as follows-
(i) SOAP Sender – Generates and transmits a SOAP message.
(ii) SOAP Receiver – Receives and processes the SOAP message and it also may generate SOAP response, message, or fault as a result.
(iii) SOAP Intermediary (Forwarding or Active)- It is both, a SOAP receiver and a SOAP sender. It receives and processes the SOAP header blocks targeted at it and resends the SOAP message to an SOAP receiver.
The SOAP message has a structure, which is characterized by two SOAP-specific sub-elements within the overall SOAP Envelope (env: Envelope), namely a SOAP Header (env: Header) and a SOAP Body (env: Body). SOAP architecture is shown in Fig. 1.
SOAP client is a program that creates an XML document containing the necessary information to invoke remotely a method within a distributed system (it could be a WEB or application server). SOAP server is responsible for executing a SOAP message and acts like an interpreter and distributor of documents. Mensagem SOAP is the basic communication form between SOAP nodes. SOAP requests to invoke a method on a service, including in parameters and SOAP responses from a service method, including return value and out parameters, and errors from a service.
SOAP is a lightweight independent protocol. It is independent and lightweight because it does not matter what OS or what platform is the service used from – it responds in the same way in any platform or OS. All this is possible because of XML and HTTP protocols.
What are the types of SOAP messaging requests? Explain.
There are two types of SOAP messaging requests-remote procedure call (RPC) and document request. These are as follows –
(i) Remote Procedure Call –
A remote procedure call represents the execution of a procedure in another remote address, usually on another computer in the same network, which is previously coded and is called a normal procedure local call. Thus, the programmer will only have to develop the code once, and it does not matter if the call is performed in local or remote circumstances.
This procedure represents a client-server model interaction, which is implemented through a request/response methodology. These requests and responses are formatted in XML. Usually, this communication is synchronous, which means that when a request is sent, the app is blocked until the response is processed and returned.
(ii) Document Requests –
While transmitting information from the client to the server or vice versa through document requests, the XML document is passed in the body of the SOAP message instead of as a parameter.
For example:- a service named Purchase Order expects a document (XML document) as the input message. When the request is sent through SOAP message, requesting the Purchase Order operation, it must contain a purchase order document as input in the SOAP message. The request is processed as soon as it reaches the server, and when processing is done, another XML document is returned as a response, which might contain any kind of information related to that purchase.
Explain the working process of SOAP messaging.
The SOAP protocol could be potentially used in combination with a myriad of other protocols, such as HTTP, SMTP, etc. It supports remote procedure calls (RPC), and asynchronous messaging style functionality also. The SOAP data model offers data type definitions to the most used structures like string, integer, float, and double e-date. The process of translating data (parameters and results) to XML is often called codification.
A SOAP package consists of four parts as follows –
(i) SOAP Envelope –
It defines a framework that contains the message content, who can process that message, and the status of obligation to process it. It is a SOAP message structure whose syntactic elements of the message are encapsulated.
(ii) SOAP Codification –
It defines serialization mechanisms that could be used to exchange instances or data types defined by an application.
(iii) Binding Framework and SOAP Transport-
It defines an abstract framework to exchange SOAP envelopes between applications using a simple transport protocol.
(iv) RPC SOAP –
It specifies how to encapsulate remote procedure calls and responses inside the message, thus invoking remote procedures. A SOAP message is an envelope containing optional headers and a body actually containing a message with its parameters or results. The SOAP messages are written in XML as follows-
<env:Envelope xmlns:env=""> <env:Body> <m:getLastTradePrice env:encoding Style=" http://www.Sirfpadhai.in/cloud-computing/" xmlns:m=" http://www.Sirfpadhai.in/Machine-Learning/" <symbol>DIS</symbol> </m:GetLastTrade Price> </env:Body> </env:Envelope> Fig. 1.8 SOAP Envelope Sample Code
The SOAP envelope presents the structure as shown in Fig. 1.9, where we can see the parts that compose the envelope. The SOAP block is a syntactic construction used to enclosure data that constitutes logically one only computational unity. The block is identified by an external element called URI namespace. The SOAP header is a collection of zero or more blocks, which could be redirected to some known SOAP receptor inside the message’s path. Finally, the SOAP body is a collection of zero or more blocks redirected to the last SOAP receptor.
The message navigates through the SOAP nodes as shown in Fig. 1.10. Once SOAP does not guarantee routing, it knows which SOAP sender created the message and knows who will be the last receptor of the message through zero or more intermediary nodes.
When a SOAP node receives a message, it must execute a process, generate success or fail messages or, if necessary, return additional messages. The process of XML messages using SOAP is shown in Fig. 1.11. The application requests a SOAP message and invokes the service operation through a Web service provider. The service requestor presents the message including the network address of the Web service provider. The network infrastructure ships the message to a SOAP server. This SOAP server redirects the requested message to the Web service provider. The WEB server is responsible to process a request message and then building a response. The message is redirected through the SOAP infrastructure. When a XML message arrives at the requestor, is converted to a programming language, being shipped then to the application.
What are the advantages and disadvantages of SOAP?
The advantages of SOAP are as follows –
(i) SOAP is platform-independent.
(ii) SOAP is portable.
(iii) SOAP is capable of getting past firewalls that are totally blocking other protocols. This is possible due to the use of the HTTP protocol.
(iv) It is unlikely that future modifications of SOA infrastructure will have any impact on applications using the method, as long as no significant serialization changes are made to SOAP specification.
(v) SOAP relies on open instead of vendor-specific technologies and thus enables distributed interoperability and loosely coupled applications. (vi) SOAP is based on the open standard XML. As a consequence, SOAP becomes easily extendable and well-supported.
The disadvantages of SOAP are as follows –
(i) Operation Interface – Useful information such as operation details and data are encapsulated within the services, just exposing only one endpoint of API and all operations use the POST method.
(ii) Interoperability – Since a specific service interface is defined for each service, a client must be bound to a specific WSDL. Once the WSDL has changed, the client has to follow these changes.
(iii) Complexity – It is time-consuming to serialize and deserialize native languages into SOAP messages. Furthermore, the WSDL protocol stack is also complex so only programmers can understand how to deploy a service.
(iv) Performance – Much information in the SOAP and WSDL is redundant and meaningless. It increases the network communication volume and server-side payload and it is difficult to support the proxy and cache servers because clients cannot identify the useful information straightforwardly from the URI and HTTP.