When making a webservice
moment I have always heard these two options as clear candidates, also taking into account their variants.
But at the moment, from the articles I have read, it is still not very clear to me.
The idea is to be able to evaluate, in which cases it may be more beneficial to use one option or another, taking into account benefits and/or harm that they may have.
SOAP and REST cannot be directly compared, since the former is a protocol (or at least tries to be) and the latter is an architectural style. This is probably one of the sources of confusion around it, as people tend to call any HTTP REST API that is not SOAP.
SOAP is defined as a communication standard protocol (set of rules), an exchange of messages based on the XML specification. SOAP uses different transport protocols, such as HTTP and SMTP. The standard HTTP protocol makes it easier for the SOAP model to tunnel through firewalls and proxies without any modification to the SOAP protocol. SOAP can sometimes be slower than middleware technologies like CORBA or ICE due to its verbose XML format.
REST describes a set of architectural principles by which data can be transmitted over a standardized interface (such as HTTP). REST does not contain an additional messaging layer and focuses on design rules for creating stateless services. A client can access the resource using the unique URI that is returned and a representation of the resource. With each new resource of the representation, the client is told to transfer state. While accessing REST resources with the HTTP protocol, the URL of the resource serves as the resource identifier, and GET, PUT, DELETE, POST, and HEAD are the standard HTTP operations to perform on that resource.
I leave you an image of a table for the simplest understanding: