REST APIs
- Is an Architectural style that follows six constraints defined by Roy Fielding in 2000. Those constraints are – Uniform Interface, Client-Server, Stateless, Cacheable, Layered System, Code on Demand.
- Follows HTTP methods and media type is a chosen by the client/server. Most used media type is JSON.
- Uses annotations like @Path, @RestController, @Mapping etc
- REST can use SOAP protocol but SOAP cannot use REST.
SOAP APIs
- Is a protocol that follows a strict standard to allow communication between the client and the server
- SOAP uses only XML for exchanging information in its message format.
- Not only tied to HTTP transport but can also be usable by SMTP.
- Uses @WebService on interface level.
- SOAP has SSL( Secure Socket Layer) and WS-security.
References:
- https://smartbear.com/blog/test-and-monitor/understanding-soap-and-rest-basics/