Introduction to Web Services

In this tutorial we will learn the basics of web services, their features and the types of web services. After this tutorial we will move forward to tutorials on manual testing and automation testing of these web services in subsequent posts.

What is a Web Service?

A Web service is a web application that can communicate with other web based applications over network. Web service implementation allows two web applications developed in different languages to interact with each other using a standardized medium like XML, SOAP, HTTP etc.

Web service introduction

Features of web services-

  • As web services are based on open standards like XML, HTTP so these are operating system independent
  • Likewise web services are programming language independent, a java application can consume a PHP web service
  • Web services can be published over internet to be consumed by other web applications
  • The consumer of web service is loosely coupled with the web service, so the web service can update or change their underlying logic without affecting the consumer

Types of Web Services-

SOAP Web Service

SOAP stands for Simple Object Access Protocol, it is a standardized protocol for message exchange between web applications. The message format supported by SOAP is XML. A web service that is based on SOAP protocol is called SOAP web service.

RESTful Web services or REST API

REST stands for Representational State Transfer, it is an architectural style that describes some constraint for web service development. A web service that satisfies these constraints is called RESTful web service. The six REST architecture constraints are-

  1. Client-Server - Client and server are separated by a uniform interface and are not concerned with each other's internal logic
  2. Stateless - Each client request is independent and contains all the necessary information required to get executed. No client data is saved at the server.
  3. Cacheable - Client should have the ability to cache the responses
  4. Layered System - A layered system having multiple layers wherein each layer communicates with adjacent layer only
  5. Uniform Interface - A uniform interface design requires each component within the service to share a single and uniform architecture
  6. Code on Demand - This constraint is optional. It extends client side execution of code transfer of executable scripts like javascript from server.

RESTful APIs implements the following types of HTTP methods-

  • GET - HTTP GET method is used to retrieve some information
  • POST - HTTP POST method submits and creates new resources
  • PUT - HTTP PUT is used to update an already existing resource
  • DELETE - HTTP DELETE is used to delete a resource

In this tutorial we studied about web services and its type. In the next post we will see the difference between a SOAP and RESTful web service.