W3C DEFINITION - s/w system designed to support inter operable machine to machine interaction over a network.

Three things for it to be a web service.

1. Application to application communication.

2. Communication over network.

3. Should be inter operable -  irrespective of tech stack.

How Data exchange takes place between applications?

Request (give me name of the person with id =1) and Response( Take the person Details).  Request and response format should also be supported by the applications(platform independent), popular formats are XML and Json.

Service Definition is where application will know the request/response format. Request structure, Response Structure, Endpoint.

Some Key Terminology in web services

  1. Request - Input to a web service.
  2. Response - Output of a web service.
  3. Message Format - communication language (XML/JSON).
  4. Service Provider - One which hosts web service.
  5. Service Consumer - One which uses the service.
  6. Service Definition  - Contract between Provider and Consumer (format, request, response, endpoint).
  7. Transport - How is service exposed - HTTP(over web)/ MQ(service requester will put request on queue, service provider will listen on queue processes request and gives response).

DIFFERENT KINDS OF WEB SERVICES

  1. SOAP
    1. Format - XML
    2. SOAP defines structure ( Header and Body)
    3. Transport - MQ / HTTP
    4. Service Definition - WSDL ( endpoint, all operations, request structure, response structure.)
  2. RESTFUL
    1. Representational State Transfer
    2. Format - multiple (XML, JSON).
    3. Rest Structure - Headers, Body, Request Methods ( GET, POST), Status Codes (200, 404).
    4. Transport - only HTTP.
    5. Service Definition - Swagger.
    6. Resource has an URI ( /login, /page/number1).
    7. Richardson Maturity Model tell how RESTful are you. Detailed explanation click here..
    8. Best Practices - nouns for resources, have clear idea of what they want, think from consumer perspective, have a good documentation like swagger, make best use of http provides.