SOAP And REST

What is a Web Service?

Anything that you can expose on a Web is called a Web Service or in other words a Web Service is just like a class whose methods are invoked by applications on different computers. On the network these method calls are done by SOAP and REST architecture.

SOAP (Simple Object Access Protocol)

As the name itself explains; it is an XML based protocol, which describes how the requests and responses are marked up, so that they can be sent via Http, TCP etc. In SOAP, the details are enclosed in an XML based format message, which can be sent between client and Server.

Example(SOAP message format)

 

SOAP always contains a root element from the soap namespace. SOAP also contains two other elements; which are header and body.
  1. In header, you can add additional XML based headers like transaction, reliable messaging and security etc.
  2. In body, you place your payload elements. For example, if your Service is dealing with the invoices, then this is where your invoice will go, as shown in the above figure in elipsis(...) 

REST (Representational State Transfer)

REST uses a traditional Web request/response mechanism such as GET and POST. In REST, the data is not wrapped or enclosed in a special format as in SOAP. In fact, REST resources(Services) are modeled with some unique identifiers and each resource request is based on http verbs like GET, POST, PUT and DELETE etc.

Example

GET http://---url--- all invoices

POST http://--url--- for creating new invoice etc.

Ebook Download
View all
Learn
View all