The following program will help us create a web service which can be called via HTTP calls from any language example Java application that can be a mobile app, desktop app or web app.
Goal is to retrieve data stored on a server
We will consider an example of a database having information of teachers.
So our database will have a table name
teacher which will have fields called
id -> teacher id,
name -> teacher name,
address -> address of teacher,
qualification -> qualification of teacher,
contact -> contact number of teacher etc.
So when we make request to our web service by giving additional information via url we can retrieve details of particular teacher or all teachers.
The output data after requesting the server will be given into json format which can be accessed very easily from any language like Java etc.
You can also read on Using JSON Web Service in Java