Introduction to Web Services
In this article we will get an introduction about what an web services is. In case of web service there are primarily two different types
- SOAP Web Service
- RESTful Web Service
The java specification for SOAP IS JAX-WS and for REST is JAX-RS
In this tutorial we will concentrate about learning SOAP Web Service.
Now what is a web service?
Basically, we can say that everything available online are services. Difference between a standard website and a Web Services is, a website stands for human consumption but a Web Services stands for code consumption.
Let us try to understand that better..
Imagine your friend has an existing application which takes a particular day as input and returns the events that take place on that specific day. Lets say it has a method getEvents() which takes the input date and returns a List of Strings containing the events. For a general website, this application is present in MVC form and is deployed in an application server. This way, the functionality is available to the end users who can send their input to the application and get their desired result.
Suppose I have a completely different App server, and I wants to use the getEvents() functionality of my friend’s application into mine.
Then one way I can do it by Getting jar of original server.
The disadvantage of this method is,
1. My friend’s application may have different application server, database and have other business which I’m not interested in.
2. If my friend changes the jar, then I need to get it and build it again.
Then Solution of the above problem is to use Web Services
Web Services allows two different applications running on different machine to communicate with each other. But there should be a network connecting these two applications.
The best part of Web Services is inter operability, i.e. java can call .net and vice versa
In the above diagram, application (A1) calls a function in application (A2).
The application (A1) which gives a call to the function is called web service client; the application (A2) which gives services to the request is called the web service endpoint.
Note: In general words, “web service endpoint” is a service which published outside for user to access; where “web service client” is the party who access the published service.
This is a basic level over view of web services. In the next tutorial we will learn about some terminology used in web service.