Web Services are software systems that are designed to support inter device communication over a network. Different types of network platforms are used for this communication.
There are several protocols available in OSI layer model and they are used at different layers for multiple functions such as data transfer, messaging, encryption etc. They give a uniform way of doing communication or exchange of information.
Today we look more in detail about SOAP (Simple Object Access Protocol) an XML based messaging protocol for exchange of information among computers.
About SOAP Web Services
SOAP is evolved as an object access protocol and released as successor for XML-RPC in June 1998.
SOAP is an acronym for Simple Object Access Protocol is a network platform used in web services for exchange/ communication of data between two different hosts on a network. XML format is used for data transfer over HTTP protocol. In web services SOAP let the user interact with other programming languages and provides a way of communication between applications running on diverse operating systems such as Linux, AIX, Windows and so on. SOAP acts as an application of the XML specification.
SOAP can be used with different variety of messaging systems and can be delivered using variety of transport protocols such as SMTP and HTTP, but initial usage focused via HTTP which is most popular method of data communication on Internet. SOAP may also be used with HTTPS with either simple or mutual authentication.
Features of ‘SOAP’
- Open standard protocol used in web service to communicate using Internet
- SOAP extends HTTP for XML messages
- It provides data transport for web services
- Used as broadcast protocol over Network
- Used to call remote procedures and complete document exchanges
- Platform independent and supports many languages (Hence language independent too)
- SOAP structure comprises of a header, envelop and body element
- Enables client applications to connect to remote services and invoke remote methods
Pros and Cons of ‘SOAP’
- Recommended by W3 consortium for web services and application programming interface to communicate with client.
- Lightweight communication protocol
- Platform independent operating system which can run on Linux, Windows and MacOS
- Use of default protocol to send message over network which is supported by all web applications
- Easy to build no toolkits needed
- Uses only XML format in web services and don’t support lightweight formats like JSON etc.
- Slow parsing speed of XML and payload is high
- No security features supported
- No state interface for remote object in SOAP client
- Limited to pooling and no event notifications . one client can use service of one server typically
- Tend to firewall latency when firewall is analysing the HTTP transport
SOAP Message Structure and Working
SOAP message is a simple XML document having below elements:
Envelop – start and end of message is defined using envelop and it is a mandatory element and contains detail of SOAP message.
Header – it has optional attributes such as credential information (authorization) , authentication etc of the message used for processing message either at end point or in between. This is an optional element.
Body – XML data comprising message to be sent and mandatory element and contains request and response information in XML format. (Actual content of message to be sent)
Fault – errors occur during processing captured here an optional element. It holds status of SOAP messages and errors.
Sub elements of Fault:
|Sub Fault element||Description|
|<faultcode>||Used to identify fault code in SOAP message|
|<faultstring>||Provide human readable description of error|
|<faultfactor>||Indicate the fault occurred during processing|
|<detail>||Application specific status error in body element|