SOAP Simple Object Access Protocol or SOAP, is the protocol for accessing a Web Service. It is an open standard being maintained by the W3C. SOAP is based on XML so the advantages of data transfer that XML has pertain to SOAP as well such as platform independence, language independent, extensible, and a W3C standard. SOAP is a communication protocol that runs over HTTP allowing two or more applications to communicate with each other. This allows SOAP to communicate through company firewalls easily. Web Services caon uses prot 80 so you don't have to open any additional prots on your fire wall which saves time and resources. SOAP was created specifically to get around the nuisances of RPC calls between COM and CORBA objects. SOAP messages are encapsulated inside an HTTP GET or POST method, which allows you to check parts of the header is necessary. Simply put, SOAP is XML over HTTP. In an HTTP Post method, the Content-Type is text/plain but in a SOAP message, the Content-Type is application/soap+xml; charset=utf-8. The Content-Length is the number of bytes in the body of the SOAP request or response message. The underlying method of data exchange for SOAP is XML. The data is represented as an XML document. The XML document is sent as a request for a service. The request is serviced and a response is sent back to the requestor in XML. Both the server and client side applications must be able to process and manipulate XML documents. Components of SOAP There are four basic components of a SOAP message:
Here is an example SOAP message. 1: <?xml version="1.0"?> While this message is an empty SOAP message, it does show the components of a SOAP message. First of all, as you can see from the example, each tag begins with the namespace SOAP. As illustrated by the example, every element of SOAP must use the SOAP message namespace. Now let's analyze the lines of the example SOAP message. Line 2 shows the SOAP envelope declaration. The SOAP Envelop is the root element of the entire message and must exist with the specified namespace value. Line 3 is the SOAP encoding style. Both of these must be declared in a SOAP message with their respective values. As already mentioned the SOAP Header element is optional. If it exists, it normally contains information about authentication or other information about the SOAP message. If it does exist, it must be the first child after the Envelop tag. Line 6 begins the SOAP body. Although there is no data represented in the body, it would be represented as tags within the body tag. Data within the SOAP message could be application specific that the application will use to call methods and return results to the requesting application. Elements within the body tag do not have to use the SOAP namespace. Line 7 opens the Fault element. The Fault element must be a child of the Body element. This element would carry any error or status information that occurred in the SOAP message. The following table shows 4 child elements of the Fault element that can offer information about the error that occurred in the SOAP message.
Many Web Services tools will help generate SOAP requests for you.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||