Making use of services via the web is a daily routine for many people. Online shopping, reading a newspaper, reserving a table in a restaurant, watching movies—these are all services that we use more or less every day. Many things happen directly between man and machine here, because the person in front of the screen is navigating through the Internet and makes decisions. However, the same amount happens between machine and machine. Requests and responses are continually sent back and forth between client and server. Web services make that possible.
What is a web service? Definition of the solution
A web service provides aservice over the Internet. It is therefore an interface through which two machines (or applications) can communicate with each other. Here, two properties are crucial—the service must be:
- platform-independent: Client and server do not need to have the same configurations to communicate with each other. The web service ensures a common platform.
- distributed: A web service is not only available to just one client in most cases. Different clients access the service over the Internet.
When a web service is used, a client sends a request to a server, triggering an action on that server. The server then sends a response back to the client.
The technology behind a web service – with an example
A web service is contacted via a unique Uniform Resource Identifier (URI). Similar to a Uniform Resource Locator (URL), which can be used to address websites, the URI is an address for the corresponding web service. Theoretically, the directory service UDDI also plays a role, through which web services can be found. However, this service never prevailed and the biggest backers have withdrawn from the project.
The language Web Service Description Language (WSDL), however, is more important. A web service has a file in WSDL, in which the service is described in further detail. The client can understand from the information which functions it can perform on the server through the web service. Finally, the communication works through various protocols and architectures. The network protocol SOAP in combination with the Internet standard HTTP or also RESTful web services, for example, are very popular. Requests and answers are sent back and forth with these techniques.
The communication often works with Extensible Markup Language (XML). The relatively simple language can be understood by humans and computers alike and is ideally suited to connect systems with different preconditions. But REST also allows other formats such as JSON.
Here is a web service example for clarification: Let's start with software written in Visual Basic, running on a Windows computer. The program requires the service of an Apache web server. To enable this, the client sends a SOAP request in the form of an HTTP message to the server. The web service interprets the content of the request and ensures that the service performs an action. After execution, the web service formulates a response and sends it back to the client, again using SOAP and HTTP. There, the answer is interpreted again, and the information reaches the software, where it is further processed.
Advantages and disadvantages of web services
The main advantage of web services is that communication is platform-independent. Client and server do not require common features in order for communication to work. To do this, web services rely on standardized formats, which understand all systems.
One of the disadvantages, however, lies in these formats. XML is a rather bulky format which leads to large data packets. This can cause problems with slow network connections. Another way two systems can connect over the Internet is through Web APIs—interfaces that can also be accessed over the Internet. Although these are generally faster, they have many clearer specifications for the client and server, which limits interoperability.