Welcome to this ultimate beginner's guide to web services. Here you'll learn web service basics - what are requirements for a piece of software to qualify as web service and what are mostly used types of web services.

What is a web service?

Requirements for a piece of software to be identified as web service are (by W3C definition):

  • it should be designed for machine-to-machine (or application-to-application) interaction 
  • it should be interoperable and platform-independent
  • it should allow communication over a network

This machine-to-machine communication is based on the client-server approach where main concepts are requests (service inputs) and responses (service outputs). If application A (service consumer) needs to do some work with application B (service provider), it will send a request containing data for specific operation - it could be getting data or changing the state of some object in a database of application B. Application B will process the request from application A and then send a response to it.

 Platform independence means that web service could be called from any system, no matter which platform it's using, whether it is Java, PHP, C# or something else. For service to be platform-independent, it's important for request and response to be platform-independent - it should be in common format supported by all platforms. Popular formats for data exchange between applications are XML(Extensible Markup Language) and JSON(JavaScript Object Notation).

Since communication should take place over a network, how does application A knows endpoint, the structure of request it should provide to application B or structure of response it will receive? It's solved by concept of service definition - application B should expose it so that service caller, in this case, application A knows how to communicate with it. So, a service definition is considered a contract between the service provider and service consumer and it contains the following elements:

  • request and response format - message exchange format (for example XML, JSON)
  • request structure
  • response structure
  • endpoint - location of service

Data transport between service consumer and service provider could be done using different ways of transport - for example directly over HTTP or indirectly using MQ.

Web service types

There are mainly two types of web services:

  • SOAP
  • RESTful

They are briefly discussed in this article.

Pin It


Please enable the javascript to submit this form