Web Service at a Glance.
What is Web Service?
A Web service is medium of communication between two electronic devices over a network. It is platform independent and programming language independent. They help us to exchange information across different machines.
What compromises Web Services?
A web service generally composed of the followings.
SOAP (Simple Object Access Protocol):- is a protocol specifiation.
UDDI (Universal Description, Discovery and Integration):- is a registry over the Internet that helps to register and locate web service.
WSDL (Web Services Description Language):- is a XML file that is used for describing the functionality offered by a web service.
What data is generally preferred in Web service?
XML and JSON are the two most prefferred medium in web service.
How SOAP works?
A SOAP is an ordinary XML document with following elements
Envelope(required) −This is the root element and encapsulates the complete information.
Header(Optional) − Holds some attributes of the message that are helpful in processing the message.
Body(required) − It holds the actual XML data that we are intersted in sendin accross the network.
Fault(optional) − provieds error information that may occurs during the processing of the message.
What is RESTful Web Service?
REST stands for REpresentational State Transfer.
In REST Architecture considers everything as resource. RESTful web services are very fast, scalable and easy to maintain.
What are basic difference between SOAP and REST Web Services?
1) SOAP is a protocol but REST is an architecture.
2) SOAP can’t use REST but REST can use SOAP web services.
3) SOAP uses services interfaces to expose the business logic. REST uses URI to expose business logic.
4) JAX-WS is the java API for SOAP web services. JAX-RS is the java API for RESTful web services.
5) SOAP definitions needs to be strictly followed. REST does not define too much standards .
6) SOAP is heavy weight. REST is light weight and requires less bandwidth.
7) SOAP supports XML data format only. REST supports Plain text, HTML, XML, JSON etc as well.
8) SOAP is less popular. REST is used widely.