Web Services are defined as a machine to machine interaction that takes place over the world wide web. Applications and servers expose functionality and data that allows other machines to communicate with them, often through standards that have been agreed upon by organizations, corporations and the community.
Previously, there had been many attempts to allow different applications to be able to talk to each other, especially for business. DCOM, EDI, CORBA were all pieces of attempts to make machine to machine communication possible.
With the worldwide web came http. There have been different standards that have run on top of this protocol, such as SOAP, or Simple Object Access Protocol. SOAP is operating system independent and is XML based. If a request is sent to a SOAP server, the server will be able to parse the message and send a response back, which can also be parsed. Each party can exist in a completely independent infrastructure and still be able to communicate programmatically over the www through firewalls. A SOAP message generally consists of a SOAP envelope, a header, a body and a fault. There are then extensible features such as security. With SOAP also came the WSDL, or Web Service Description Language, which described what web services were on offer, greatly helping the development process.
SOAP does have a couple of disadvantages, namely that the XML contains a large amount of information, which can mean larger files to transmit and a longer parsing time.
REST, or REpresentational State Transfer, is another way applications can communicate. In theory it is a design concept for managing state information. RESTful web services use specific URLs. E.g. http://website.com/items/ could represent a list of items. http://website.com/items/101/ could represent a particular item.
REST methods for CRUD are achieved through HTTP verbs:
- GET – retrieve
- POST – update
- PUT – create
- DELETE – delete
REST is advantageous in that it is fast and simple.
As mentioned, SOAP uses XML as it’s format choice. The output of REST can be XML, JSON, CSV, RSS etc, which can make it easier for a consuming application to parse.
“street”: “1 Times Sq”,
“city”: “New York”