What Are Web Services And How Do They Work

What Are Web Services And How Do They Work

Today we will talk about Web Services . Before reading the further, I would like to tell you that web services are of two kinds. The first one is SOAP service and second is RESTFUL web services. In this article I’ll be telling you all about SOAP Web services. So what are the Web Services.

Web Service is a way by which you can distribute all your data to the outside world in a certain format that can be parsed or retrieved by any technology or supporting language. For example, Suppose I have a movie database which contains information about all movies like their release year, their casts, their music tracks etc. Now I can distribute this whole data through Web Services and allow the people to make their own movie information websites by consuming my web services.

Again in the technical sense, Web Service is a technology in which a method or function of one application is called by another application. The application having that method or function is called Web Server and which calls that method is called service consumer or service client.

What Are Web Services And How Do They Work

So basically, there are two participants in a web service. First one is the web server on which I have all my web services and another is a client who consumes my  services. Client invokes a method of certain web service which is provided by the server. One web service can have one or multiple methods or functions. The server may or may not return a value to the client or perform some operations. The best analogy that we can take for better understanding about web service is telephone directory services.

So what is a telephone directory service? A telephone directory service is a service in which you call some number like 1111 or something else and you ask for a business contact number. There are following four things which are involved in this service:

1. First thing in which you will be giving some input to the telephone directory service that may be the name of candidate or name of business whose business contact number you want.
2. Second thing is the medium through which you will be contacting them that is your telephone.
3. Third is the language. You will be communicating with them in a human language or some another. This is called your message format.
4. And finally you will be getting a contact number provided by them.

Now if I relate the same thing for my web services, it is similar to the telephone directory services which we were talking about in above four points. So again I am repeating the these points for my web services also:

1. According to the telephone directory example, we have to pass some input parameters to the web service to get a valid response. If we want the movie information from a movie web service, we have to pass some parameters like movie release year or something else to the web service.
2. Second thing is the medium through which we will be communicating to the web service. Medium we can say is the LAN (For local web environment) or Internet. In many cases it is Internet.
3. Third things is the format of your message. In which format your input queries are being passed to the web service? It is SOAP format that is called Simple Object Access Protocol. When you pass an input parameter, first it is converted into SOAP format and then it is received by the appropriate web service.
4. And last thing is the way of communicating. In almost cases it is HTTP as it is consumed by the web browser or HTTP method.

So finally your way of communicating with web services is HTTP, your message format is SOAP, medium is internet and the query is input parameters. In the above terms I’ll be getting some output parameters or response from the web service.

Now I have my web service on the web server which was developed using PHP script. And at another end, my client is consuming the web service. Suppose the client could be a .NET client or a Java client. So how it would be possible to recognize a web service and consume it if both the server and client applications are developed in different technologies as in our case. This becomes possible through a third specific language file that is called WSDL (Web Service Description Language) file. As understood by the name, this is a simple XML file which contains all the information about the specific web service such as it’s description, usage, input parameters taken by it and output parameters or response given by the service etc. So what I’ll be consuming the web service means I’ll be using this WSDL file. I’ll be passing a request to this WSDL and this WSDL will give me the response in SOAP format. So you are seeing that I’ve developed my web service in PHP and I’m consuming this service in .NET. We can say that if I develop my web service in .NET or Java, this will be available to as in the form of WSDL. So the web services make them as language inter-operable or we can say technology inter-operable.

See, I have my own web application in which I need to implement some online transaction where I need to give my credit card number and its expiry date then a transaction will take place and the amount will be deducted from my account and will be transferred to the website owner. It may be so easy with help of web services. The half functionality has already developed by payment gateways and I can consume the payment gateway’s web services to do that. Another thing is that if I need to implement a search engine in my website then I’ll be using google or bing’s search engine web services.
So this was all about your SOAP web services.