What is web service and what are the different types of web services?

Web Service:

Web Services is a technology communicate between two electronic devices over internet or intranet using collection of standard protocols on world wide web(WWW), service data typically exchange XML or JSON format.

A standard Web Service using below components:

  • XML (eXtensible Markup Language)
  • SOAP (Simple Object Access Protocol)
  • UDDI (Universal Description, Discovery and Integration)
  • WSDL (Web Services Description Language)

XML is stands for eXtensible Markup Language. A uniform data representation and exchange mechanism that defines a set of rules for encoding documents in a format that is both human and machine readable.

SOAP is stands for Simple Object Access Protocol. SOAP is a HTTP based protocol specification for exchanging structured information in XML form, interact across any computer networks, specifically HTTP (Hypertext Transfer Protocol).

UDDI stands for Universal Description, Discovery and Integration. UDDI is a platform independent, UDDI is a XML based network protocol, where web service register their web services and client can search, find and invoke web services. SOAP is the most popular protocol for communication.

WSDL stands for Web Services Description Language, WSDL is written in XML format and it is used standard meta language to describe the web services offered, WSDL is program/language that describes the provider services as a set of endpoints messages containing either document-oriented or procedure-oriented information. The same web service can have multiple endpoints using different protocols and what communications protocol is used to talk to that services.

 

Web Services Types:

  1. SOAP (Simple Object Access Protocol)
  2. REST (Representational State Transfer)

 

SOAP is stands for Simple Object Access Protocol. SOAP is a HTTP based protocol specification for exchanging structured information in XML form, interact across any computer networks, specifically HTTP (Hypertext Transfer Protocol).

REST stands for Representational State Transfer. REST is architectural principles for building web service using HTTP protocol using basic HTTP methods like POST, GET, PUT and DELETE (CRUD – Create, Read, Update, and Delete).

 

REST web service supports formats like JSON, XML, HTML and Text

  • REST uses standard methods like

 

What is differences between SOAP web services and REST web services?

SOAP and REST web service cannot be compared directly, see below differences.

S.No SOAP REST
1 SOAP stands for Simple Object Access Protocol. REST stands for Representational State Transfer.
2 SOAP is a protocol REST is an architectural style
3 SOAP can use almost any transport request REST uses HTTP and HTTPS
4 SOAP supports state full calls REST is totally stateless operations
5 SOAP is more strict contract in the form of WSDL REST do not have any strict contract
SOAP defines own security REST will inherit the transport level security over HTTP.
6 SOAP response cannot be cached REST response can be cached
7 SOAP format will be restricted to XML REST will support formats like XML, JSON, HTML, Text
8 Java API for SOAP Web Services JAX-WS Java API for REST Web Services JAX-RS
9 SOAP requires an XML wrapper for all the request and response REST is lighter, this reason REST is prepared for mobile devices
10 SOAP bit slower and less prepared REST is faster compare to SOAP, more prepared, simple to use and lightweight