Simple Object Access Protocol (SOAP) is the messaging protocol for web services. It is used to encode the information in the request and response messages. A SOAP message is operating system independent and it is a way for one program to communicate with other programs independently to the operating systems of the other programs. The SOAP messaging framework consists of four parts, the SOAP processing model, the SOAP extensibility model, the SOAP protocol binding framework, and the SOAP message construct. The processing model defines “the rules for processing a SOAP message”.
Overview of Simple Object Access Protocol
SOAP supports different styles of information exchanged. It supports a Remote Procedure Call (RPC) style, which allows a request- response processing. And it also supports message oriented information exchange. This is good if you like to exchange business documents or other types of documents where the sender may not expect to get a response immediately. SOAP also have the following features:
- Protocol independence
- Language independence
- Platform and operating system independence
- Simple and extensible
SOAP is an XML-based protocol from the W3C for exchanging data over HTTP. It provides a simple, standards-based method for sending XML messages between applications. Web services use SOAP to send messages between a service and its client(s). Because HTTP is supported by all Web servers and browsers, SOAP messages can be sent between applications regardless of their platform or programming language. This quality gives Web services their characteristic interoperability.
- SOAP messages are XML documents that contain some or all of the following elements:
- Envelope – specifies that the XML document is a SOAP message; encloses the message itself.
- Header (optional) – contains information relevant to the message, e.g., the date the message was sent, authentication data, etc. l Body – includes the message payload.
- Fault (optional) – carries information about a client or server error within a SOAP message.
Data is sent between the client(s) and the Web service using request and response SOAP messages, the format for which is specified in the WSDL definition. Because the client and server adhere to the WSDL contract when creating SOAP messages, the messages are guaranteed to be compatible. When an application receives a SOAP message, it must process that message. This is done by identifying all parts of the message that are intended for the application and verifying that all mandatory parts identified are supported by the application and process them accordingly. The message is discarded if not all mandatory parts are supported; any unsupported optional parts are ignored. If the message is to be forwarded, the parts identified are removed before forwarding the message.
How Does Simple Object Access Protocol Work?
SOAP requests are easy to generate, and a client can easily process the responses. One application can become a programmatic client of another application’s services, with each exchanging rich, structured information. The ability to aggregate powerful, distributed Web services allows SOAP to provide a robust programming model that turns the Internet into an application development platform.
The SOAP specification describes a standard, XML-based way to encode requests and responses, including:
- Requests to invoke a method on a service, including in parameters
- Responses from a service method, including return value and out parameters
- Errors from a service.
SOAP describes the structure and data types of message payloads by using the emerging W3C XML Schema standard issued by the World Wide Web Consortium (W3C). SOAP is a transport-agnostic messaging system; SOAP requests and responses travel using HTTP, HTTPS, or some other transport mechanism.
Figure 1 illustrates the components in the SOAP architecture. In general, a SOAP service remote procedure call (RPC) request/response sequence includes the following steps:
- A SOAP client formulates a request for a service. This involves creating a conforming XML document, either explicitly or using Oracle SOAP client API.
- A SOAP client sends the XML document to a SOAP server. This SOAP request is posted using HTTP or HTTPS to a SOAP Request Handler running as a servlet on a Web server.
- The Web server receives the SOAP message, an XML document, using the SOAP Request Handler Servlet. The server then dispatches the message as a service invocation to an appropriate server-side application providing the requested service.
Figure 1: Components of the SOAP Architecture
Advantages and Disadvantages of SOAP
Some of the advantages of leveraging SOAP include:
- It is platform and language independent.
- SOAP provides simplified communications through proxies and firewalls, as mentioned above.
- It has the ability to leverage different transport protocols, including HTTP and SMTP, as well as others.
Some disadvantages of leveraging SOAP include:
- SOAP is typically much slower than other types of middleware standards, including CORBA. This due to the fact that SOAP uses a verbose XML format. You need to fully understand the performance limitations before building applications around SOAP.
- SOAP is typically limited to pooling, and not event notifications, when leveraging HTTP for transport. What’s more, only one client can use the services of one server in typical situations.
- Again, when leveraging HTTP as the transport protocol, there tends to be firewall latency due to the fact that the firewall is analyzing the HTTP transport. This is due to the fact that HTTP is also leveraged for Web browsing, and many firewalls do not understand the difference between the use of HTTP within a Web browser, and the use of HTTP within SOAP
- SOAP has different levels of support, depending upon the programming language supported. For example, SOAP support within Python and PHP is not as strong as it is within Java and .NET.
 W3C Working Group. SOAP Version 1.2 Part 1: Messaging Framework, June 2003. www.w3.org/TR/soap12-part1.
 Mehdi Zekriyapanah Gashti, “Investigating Soap and XML Technologies in Web Service”,
 “Simple Object Access Protocol Overview”, available online at: https://docs.oracle.com/cd/A97335_02/integrate.102/a90297/overview.htm
 “SOAP (Simple Object Access Protocol)”, available online at: http://searchmicroservices.techtarget.com/definition/SOAP-Simple-Object-Access-Protocol