SOAP or Simple Object Access Protocol is a protocol that allows applications to exchange data via the HTTP (hypertext transfer protocol) protocol. Though it is not the only way for communication of data between applications, it has some advantages over other distributed protocols that use RPC (remote procedure calls) in order to communicate between different types of objects, like DCOM, CORBA and GIOP and IIOP using a binary format. HTTP was not designed to support this kind of communication, which has limitations when going through proxy servers or firewalls. Being able to use HTTP as its transport method , SOAP is not subject to the limitations as the other distributed protocols when it comes to going through firewalls and proxy servers.
Since it is based on XML, the data is communicated in text format, and not some complex binary format. This has the advantage of having interoperability between different platforms and even applications developed in different programming languages. The drawback to using a text based protocol (XML) is that it takes longer to process than the messages in binary format. However, since it is very important for applications to be able to interact over the internet, the advantages outweigh the disadvantages. There is even research being carried out to increase the throughput of XML messages.
A SOAP message is essentially used to send a request to the server with the web service and then to return the result to the client application that placed the request.
A SOAP message essentially consists of a structured XML document with a few specific elements:
• An envelope element that indicates that it is a SOAP message.
• A header element containing its header information. This contains application specific information like authentication and has to be the first child element in the XML document.
• A body element. This element will contain the information about calling it and getting its response. This section contains the data that is required for the ultimate recipient of the SOAP message.
• A fault element, which contains the data about errors and information regarding its status. If this element is present, it must be a child of the body element and can only appear once in the entire document. This will have its own child elements. This element will include information about the code, description of the fault and the reason the fault occurred, i.e. who caused it. It also contains information of the error caused at the level of the application.