The universe of programming languages is vast and full of technologies, and it has always been very difficult to make products of different platforms communicate among them.
In our current world, it has become imperative to make this communication more fluid, as we now are able to provide services across the world using the Web.
Imagine, for example, that your company wants to create new software to provide some retail stores with information regarding the new products your company is producing, for this you used PHP as your programming language. What if retail stores related to your company don’t use PHP in their applications?, what if they instead use Java, Python, C#, or any other programming language?
To solve this, we must come with a mechanism to make this heterogeneous systems to communicate.
Introducing Web Services
In a nutshell, a web service is a software system capable of interacting with other software systems regardless of the differences in architecture, platform, or programming language that could exist between the mentioned systems.
Web services solve the communication problem between heterogeneous systems, allowing us to share messages between software systems developed using different platforms.
To make this possible, Web services must:
- Be accessible through a private or public network (usually over the web)
- Share a communication protocol with the client system
There exists currently two main types of web services we can implement in most programming languages or frameworks:
- XML based web services (SOAP)
- RESTful web services
SOAP Web Services (XML based)
These web services share XML messages with their clients following the Simple Object Access Protocol (SOAP), which defines the format and architecture for the messages.
SOAP web services must establish a contract that defines the messages, operations, and location of the web service. This contract is written using an XML based language called Web Services Description Languages (WSDL). This document is used by client applications to access the web service and consume the operations provided by it.
RESTful web services
The REpresentational State Transfer(REST) is an architectural style commonly used over the web (HTTP protocol) for the creation of web services. Web services based on the REST architecture are commonly called Restful web services.
Restful web services can use a variety of technologies to share “resources”: text, XML, JSON, among many others. Resources are accessed using the HTTP methods: GET, POST, PUT, DELETE.
Independent of the type of web service implemented, the use of web services bring many advantages for the development of software:
- Web Services allow the interoperability of heterogeneous systems
- Web Services allow creating loosely coupled software systems, as its implementation code will be totally independent of the application that consumes it
- Operations or resources provided by a web service can be reused by multiple systems
- It is really simple to deploy a web service and integrate it with any other system