Sunday, 1 March 2015

Web service Introduction



Webservice:

A service available over the network can be accessed by other applications irrespective of their platform. It’s a method of communication between two devices over the network in order to exchange the information between them.

It’s a communication between applications to application. Mostly human won’t directly communicate with the web service. Human user usually communicates with the application either desktop based or web based. That application can interact with the web service and gets back the result. This result is present to the user in a more pleasant way.

Difference between web application and web service:

Web application meant for human consumption. You can login to any website and you can access those applications. You can login to a bookmyshow.com to book a movie ticket. You can select a movie and seats (of course a corner seat). Once you come for payment it will show all the available options like debit cards, credit cards and net banking. Consider you select net banking. Now it will route you to your bank site. After a payment it will come back to movie site again and confirm your booking.
                Now consider the things running around the background. The amount needs to be debited from your account and it needs to be credited to theatre’s account (Here bookmyshow.com engages itself with lot of theatres). The data exchange happening between the multiple applications running on multiple platforms.


Interoperability:




Thus an application can communicates with any web services deployed in multiple environments. This feature is known as interoperability. Thus a .Net based web application deployed on windows can communicate with a Java based application deployed in Linux.

Why we Need a web service?

Consider you have a fine application which will give weather information, if we give a city name as input. And you make it as a service and deployed in a web server A. All the other applications in a ‘web server A’ can access this application. You want another client application deployed in a web server B to access this application. Is this possible?




Yes (tentatively), by giving a jar of your GetWeather application and let your client application to call its methods. But the methods of the GetWeather app may access the database and you may need to give a authentication details of this database to your client. This is more ridiculous because another client may come after some time and you may need to share the same details to him.
Consider you are upgrading your GetWeather application by adding more cities and other information. Now in order to access this upgraded services, your application needs to be deployed in all the other web servers too which is too painful.
Instead you can let your client applications to access the single instance of the GetWeather application by making it as a web service. And your client will always access updated one.
Reusability:
                Consider you have developed a application for payroll processing. You may have number of clients using this payroll processing. Instead of developing applications for each client you can create one application and make it as web service and let others to consume this. You can do a minimal level of customization for each client. If a tax system changes you need to modify each of your client application – just put all these stuff in a web service. Client will get a updated one.

Web services were classified as shown in the diagram.


No comments:

Post a Comment