Select Page

REST Services vs. Web Services

Last post dedicated to REST services, in which we contrast its features to the web service

Third and final post dedicated to REST services:

Both REST-based Web Services (RESTful Web Services) and SOAP-based Web Services have a Client-Server architecture so that clients can obtain information from the server via the Web. However, both services have a different way of accessing information.

The first difference is the way information is structured. Web Services allow access to server information through verbs or functions. A Web Services client must call a function that the server will execute and the result will be returned. For example, it could take this form:

http://www.MiEmpresa.com/Sensores/RecogeDatosSensor(Sensor001)

However, Rest services are oriented to resources or objects.

http://www.MiEmpresa.com/Sensores/Sensor001

Since there are no verbs in REST services, there are no functions to collect the complete catalog of resources. The solution is to create a new resource that represents the complete catalog of resources:

http://www.MiEmpresa.com/Sensores

The response to this request may be a list of resources from which to compose the URLs of each resource. There may even be a link in each of the identifiers returned so that it is not necessary to compose the new URL, but it is sufficient to copy it.

Another important difference between REST-type Web Services and SOAP-based Web Services is that, in the latter, it is necessary to use development tools to generate the clients from the WSDL. This implies that the result must be compiled in some language and put into operation on some device capable of interpreting the compiled code. On the contrary, REST-type Web Services do not need to compile any server function and use the standard methods of the HTTP protocol, which are very easy to implement on client devices. In this way, any sensor capable of connecting to a network with an IP address, which therefore implements HTTP, will be able to consume REST services. Therefore, universality is gained.

However, this ease of implementation has its limitations. For example, WSDL defines the types of variables exchanged between server and clients, which can even be complex structures.

HTTP

Conclusions

With the current volume of information on the Web, it is necessary to find a simple way to exchange information between devices, or from devices to systems in the cloud. There are different ways to exchange information between machines, but a really simple way to implement is the one based on REST services.

REST services are not a new concept, but simply define architectural principles for accessing information on the Web. Resources are defined on one or more servers that are accessible through standard HTTP methods such as GET, PUT, POST or DELETE. It is as if Web pages were being generated accessible from the standard HTTP protocol, that is, accessible from any Web client.

REST services are not always the best option for exchanging information between server and clients, but it is so simple to use and implement that it is gaining more and more presence on the Internet. A simple sensor connected to the Internet and capable of implementing the HTTP protocol can be part of a REST architecture.