Web Services – An Overview

Web service is a software function provided over the internet. What a normal software function does? Takes an input, processes, and gives an output. Web service also does the same over the web or internet. This is a self-contained, self-describing application. It does not depend on any programming language or operating system. Web services are hosted on the internet and can be accessed by any other system.

Let us have some thoughts on web services as a layman does.

If I build a web service, what is the method of communication?

What protocols should it use?

Can it just read? or read and write both or can it even execute some program?

Below is an example of web service,

Protocol: HTTP

Method: GET

URL: http://www.sample.example.com/v1/service/bookticket/qty?ticketRefId=tid12345

Request Headers:

Accept: application/xml
Content-Type: application/xml
Content-Length:0
Authorization: authorization-token

Request Body:

XML Request:

<?xml version="1.0" encoding="utf-8"?>
<ExampleReqstBody xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ExampleNode>
    <Name>Seetaram</Name>
    <AccountNo>123456</AccountNo>  
    <PhoneNo>1111111111</PhoneNo>
    <City>Bangalore</City>  
    <State>Karnataka</State> 
    <Country>India</Country> 
  </ExampleNode>
</ExampleReqstBody>

From the above sample web service we can understand that from any system if the web service is called with the necessary parameters the intended function will be done. Plain English meaning of "Service" is "Work done by one person or group that benefits another". Web service is the one which is a self-contained, self-describing component of a software system which is available over the network. An application built to communicate with multiple applications need to use standard protocols for communication. XML is the standard way of communicating across different operating systems / environments.

Think of an application which you want to build and make sure that can be integrated with any other system. For this kind of requirement architecture design pattern can be "Service Oriented Architecture". This architecture exposes all the application functionalities as services. Thereby other systems can easily interact.

Web services use XML and JSon request and responses and Http protocol. Very basic elements of a web service include,

  1. XML (Extensible Markup Language)
  2. HTTP (Hyper Text Transfer Protocol)
  3. UDDI (Universal Description, Discovery and Integration)
  4. SOAP (Simple Object Access Protocol)
  5. WSDL (Web Services Description Language)
  6. REST (Representational State Transfer)
  7. JSon (JavaScript Object Notation)

There are two types of Web Services:

  1. SOAP
  2. REST

SOAP

Simple Object Access Protocol (SOAP) is a protocol used for implementation of web services. SOAP message is defined by standard WSDL (Web Service Description Language). SOAP message consists of an envelope, header, body, and fault. These are the building blocks of a SOAP message. These blocks are used to identify the document as SOAP message, header information, data for the call, and about any errors that happened.  

REST

REST stands for "Representational State Transfer", which is a type of architecture design. RESTful web services are implemented using REST principles. These are lightweight in nature, stateless, and cacheable. In REST based architecture, server provides access to resources and the client will access the same. Resources can have different representations such as XML, JSon, text, etc. REST uses HTTP methods GET, POST, PUT and DELETE methods for CRUD (Create, Read, Update and Delete) operations. We will discuss more on this topic in future posts.

Technorati Tags: ,,

Comments 1

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.