7 Myths About Web Services
Web Services: mastering the basics.
Join the DZone community and get the full member experience.Join For Free
Despite the popularity of SOA and Microservice Architectures, some technological and implementation details are often missunderstood or incorrect interpreted. In this article, we will review seven facts about Web Services that can help developers to better understand the concepts and also to better prepare for interview questions if needed.
You may also The HTTP Series (Part 1): Overview of the Basic Concepts.
HTTP Is Absolutely Required for RESTful Services
HTTP is not formally required for RESTful web services, but if HTTP methods are used, their formal meaning should be strictly followed so that without additional effort the clients can understand the API (e.g. do not use POST to update data, it is supposed to only create resources and is not idempotent by nature).
JSON Is the Format Used for REST APIs
The most common format for REST APIs is JSON, but by no means the only possible format that can be used. The REST model is a strong fit for IoT. However, the JSON’s string-oriented payloads are no match for binary encodings when it comes to data transmission in terms of speed and ease of parsing in the IoT environment. Other formats can be more appropriate in such situations.
HTTP PUT Method Is a Partial Update
HTTP PUT method is a full replace, not a partial update. It is similar to overwriting a complete file rather than updating a single column.
RESTful Web Services Use Browser Cookies to Store State
RESTful communication between client and server must be stateless. There should be no cookies, session variables, or any other stateful feature in use.
The SOAP Protocol Only Uses HTTP POST for all Requests
According to SOAP specification, both GET and POST methods can be used to exchange SOAP messages over HTTP. The use of the HTTP POST method for conveying SOAP messages in the bodies of HTTP request uses a pattern called SOAP request-response message exchange pattern. In the case of HTTP GET, a pattern is used called SOAP response message exchange pattern.
REST Services Can Only Be Used for Simple CRUD
REST services are very popular when it comes to the implementation of CRUD operations but they are by no means only restricted to that. A very good example is the state transitionin implemented in Atlassian Jira. It provides an endpoint to first get a list of possible transitions based on their status and as a second step the transition can be performed as an HTTP POST request.
REST Is the Universal Integration Style in Enterprise Software Architectures
As stated in the Enterprise Integration Patterns book, there are four top-level integration alternatives: File Transfer, Shared Database, Remote Procedure Invocation, and Messaging. The RESTful services integration style is classified as Remote Procedure Invocation. All four options with their advantages and disadvantages have to be considered when architectural decisions are taken.
Opinions expressed by DZone contributors are their own.