Introduction of SOAP

  • SOAP was initially called as XML-RPC.
  • The stable release version of SOAP is/was v1.2 in April 2007.

Definition

  • SOAP is XML-based, hence lightweight(i.e. only uses XML format of data/message for request and response), Application layer protocol for accessing/exchanging of information in a decentralized way from several web services distributed over the Internet via HTTP protocol mainly. It defines how web services talk/communicate to each other or to client applications that invoke/call them.
  • It is a standards-based web services access protocol that sends messages using other protocols such as HTTP and SMTP.
  • It is the protocol used for data interchange between applications in a distributed environment in the form of XML.

Need of SOAP

As we know in today’s world, there are a large number of web applications that are built in different programming languages and environments per day. For example, there could be a web application designed in Java, another in .Net, and another in a PHP environment. So, exchanging data between user apps and web applications is crucial in today’s networked world. However, data exchange between these heterogeneous applications would be complex and time-consuming. So will be the complexity of the code to accomplish this data exchange. Thus, one of the methods used to combat this complexity appears to use XML (Extensible Markup Language) as the intermediate language for exchanging data between applications.

As it is clear that every programming language can understand the XML markup language. Hence, XML was used as the underlying medium for data exchange. Again, there are no standard specifications on the use of XML across all programming languages for data exchange. That is where this protocol comes into existence.

Thus, this protocol was designed to work with XML over HTTP and have some sort of specification that could be used across all applications.

Features/Characteristics

  • SOAP stands for ‘Simple Object Access Protocol’.
  • All communication by this protocol is done via the HTTP protocol. Before this protocol, a lot of web services used the standard RPC (Remote Procedure Call) style for communication. This was the simplest type of communication at that time, but it had a lot of limitations.
  • This protocol is considered a messaging protocol and is still used in many Web Services or big organizations or institutions of the world. With built-in security and reliability functions, this protocol is a great choice for applications where security is more critical than performance.
  • This protocol is a communication protocol to communicate data/messages between applications.
  • It Uses HTTP (port 80) or SMTP ( port 25 or 2525 ) protocol for message negotiation and transmission.
  • It is independent of any transport protocols i.e. it may work with either anyone such as HTTP, FTP, TCP, UDP, SMTP, or others).
  • This protocol is a network protocol for exchanging structured data between nodes. It uses XML format to transfer messages.
  • This protocol is more secure than REST protocol as it uses WS-Security(Web Services Security) for transmission along with the Secure Socket Layer(SSL) concept.
  • It is a state-full process (not stateless) as it takes the entire request as a whole to process it.
  • It allows clients to invoke web services and receive responses that are independent of programming languages and platforms/OS.
  • Working Mechanism : 

When a SOAP client starts a request for a service then it involves creating a conforming XML document, either explicitly or using Oracle SOAP client API. A SOAP client now sends the XML document to a SOAP server. This SOAP request is posted finally using HTTP or HTTPS to a SOAP Request Handler, running as a servlet on a Web server. On getting the request, the web server responds to the SOAP client as an XML document.

Architecture

SOAP: Architecture of SOAP Protocol

  • SOAP Message describes what is sent to the web service and the client application.
  • SOAP messages are normally auto-generated by the web service when it is called i.e. Whenever a client application calls a method in the web service, the web service will automatically generate a SOAP message which will have the necessary details of the data that will be sent from the web service to the client application.
  • The SOAP message tells the client application what is the name of the Web service, and also what parameters it expects, and also what is the type of each parameter that is taken by the web service.
  • By default, the SOAP message can contain parameters that could be of simple types such as strings and numbers, but can also be a complex object type.
  • The SOAP message is nothing but a mere XML document which has the following components/elements –
(i) The SOAP Envelope element
(ii) The SOAP Header element (optional)
(iii) The SOAP Body element
(iv) The Fault element (optional)

(i) The SOAP Envelope Element :

      • It defines a framework for describing what is in a message(i.e. message structure) and how to process it.
      • This is the root element of the SOAP message.
      • The SOAP Envelope is used to encapsulate all of the necessary details of the SOAP messages, which are exchanged between the web service and the client application.
      • The SOAP envelope element is used to indicate the beginning and end of a SOAP message.
      • This enables the client application which calls the web service to know when the SOAP message ends.
  • (ii) The SOAP Header Element : 
      • The header element can contain information such as authentication credentials which can be used by the calling application.
      • It can also contain the definition of complex types which could be used in the SOAP message.
  • (iii) The SOAP Body Element : 
      • It contains the details of the actual message.
      • A Body element contains call and response information
      • This element is what contains the actual data that needs to be sent between the web service and the calling application.

(iv) The Fault element (optional) :

      • In the fault element, when a request is made to a SOAP web service, the response returned can be of either 2 forms which are a successful response or an error response. When a success is generated, the response from the server will always be a SOAP message. But if SOAP faults are generated, they are returned as “HTTP 500” errors.

Advantage

  • Simplicity – Simple in structure and processing.
  • Portability – Easily operatable in any language or OS/platform.
  • Firewall friendliness/support.
  • Interoperability – Executed in different environments.
  • Universally accepted.
  • When developing Web services, Users need to have some of the languages that can be used for web services to talk with client applications such as PHP, Asp.net, JSP, etc. This protocol is the perfect common medium that was developed to achieve this purpose. This protocol is also recommended by the W3C consortium which is the governing body for all web standards.
  • Since this protocol is a lightweight protocol due to the use of XML, hence is used for data interchange between applications quickly.
  • This is designed to be a platform(OS) and language-independent hence this protocol can work in any environment or language well.
  • It works on the HTTP protocol, which is the default protocol used by all web applications. Hence, there is no sort of customization which is required to run the web services built on this protocol to work on the World Wide Web.

Disadvantage/Demerits

  • It relies too much on HTTP protocol to communicate.
  • The serialization process occurs during processing which is by value method not by reference method.

Loading


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.