Thursday, February 10, 2011

Web services – Practical example – (beginners only)

This article is intended only at first time web service users. People who do not have the required visibility of distributed computing and web services. All other users please refer to the next article in this series.

Time and again we hear from people that they are using “webservices”. Let’s take a brief glimpse into the world of web services and understand a practical scenario where and why we may want to use webservices.
Case Study: Take the case of a Travel Website (the likes of Yatra.com, makemytrip.com, cleartrip.com etc.). A normal operation between a user and the travel site would look like:-
  1. User logs onto website
  2. Searches for flights on a particular day
  3. Selects the flight most suited
  4. Enters passenger data for the flight
  5. Makes a payment on a banking gateway
  6. On successful payment gets a confirmed PNR number.
In this simple interaction between the user and the travel site, the travel site had to perform 2 major interactions (excluding the payment part of it):

    a) Get the data for flights
    b) Confirm the payment and reserve a seat

On the front of it these are simple database operations with one common exception, this data should NOT be maintained by the travel site. We do not want that the data on flights (including fares) are provided from the travel site’s database because they might/will not be updated with latest figures. We definitely do NOT want the reservation of the tickets to be done at the travel site front. (Imagine a scenario that the travel site forgets to update the carrier about your ticket and on the day of flying you realize that your ticket is not valid because your travel site “forgot” to update the ticket details with the airlines.)

Soln:- The simplest solution that is available to us is to ask the travel site to get the latest data from the actual carrier and once a payment is made contact the carrier and get a PNR through them. Since in this particular case the interaction would be directly with the carrier (through a travel site) all our data is up to date and reservations are “meaningful”.

This simple and practical scenario highlights the importance of inter-computer interactions, which add meaning to the operations of a site. But (there’s always a ‘but’) there is one catch. As long as the sites are working on a common platform communication between them is easy (a simple method call will suffice). But what happens when we have different vendors for each site.

Ex:

Webservice Case study

This is where web services gains prominence. The usage of Web services will provide us a simple and effective way to communicate between the 2 (or more) computers to allow for a meaningful interaction. How it achieves this interaction is explained in greater details in the next article.

16 comments:

  1. its really a very good article for freshers(who are new to this topic) to provide a perfect view about web services.

    great work
    keep it up

    ReplyDelete
  2. excellent.....
    10 out of 10.

    ReplyDelete
  3. Simplest and the best explination for beginners....Excellent..

    ReplyDelete
  4. Interesting and very friendly to understand :)

    ReplyDelete
  5. Excellent and lot of helpful to beginners.

    ReplyDelete
  6. awesome explanation in the easiest way possible..

    ReplyDelete
  7. way of explanation is just awesome :)

    ReplyDelete
  8. Wonderful explanation! Very helpful.

    ReplyDelete
  9. webservices for Dummies! Perfect explanation for beginners like me! :)

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Bhushan - The most practical use of web services today is when you want any 2 computer systems to communicate.
      For example - take the example of Indigo airlines. Today Indigo supports multiple sites to conduct booking (eg. yatra, makemytrip, goibibo, goindigo etc.) Instead of allowing everybody to access their database,
      Indigo could expose a service which all these sites could use to make a booking.
      Another example would be movie ticket booking (inox, bookmyshow etc)

      Delete
  11. awesome explanation..............please keep it up

    ReplyDelete