Why isn't SOAP-based web service RESTful?

后端 未结 7 1374
无人及你
无人及你 2021-01-29 20:54

I understand RESTful is an architecture style, but what exactly makes SOAP-based web service not count for RESTful?

It\'s not clear to me which points below (from Wikipe

相关标签:
7条回答
  • 2021-01-29 21:09

    Restful : REST is architectural style for building web service using HTTP protocol, where web services are treated as resources and some basic HTTP methods like GET, POST, DELETE are used to identify standard action on resources. RESTful web API (also called a RESTful web service) is a web API implemented using HTTP and the REST principles.

    Soap : SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in XML form.

    0 讨论(0)
  • 2021-01-29 21:09

    SOAP Protocol: SOAP is a protocol which means that it has a defined structure to it.

    1. POST : The SOAP request always requires a HTTP body, hence the HTTP method is POST. More about HTTP Methods in a future POST (these are very relevant in REST), but for now lets assume this is always POST in case of SOAP
    2. SOAP Action : Empty means, intent in HTTP Request URI.
    3. Content-Type : SOAP uses XML as the language for communication and hence this is always text/xml
    4. with the XML Namespace (xmlns) is required to indicate that this is a SOAP Request.
    5. is the root SOAP element which describes the Request and Response.

    RESTful API Design involves breaking the system in terms of resources, and providing access to those resources through endpoints (also called operations) defined on the web service's base uris. Access is done using standard HTTP Methods and controlled by an auth mechanism. Configuration for the resource is provided and obtained through request and response with HTTP status codes communicating the status. 1. Resources are the entities that exist in the system being made RESTful. For instance, in case of a blogging website, these can be the blogs, posts and comments. 2. EndPoints or operations provide a mechanism through which these resources can be accessed. For instance, the endpoint to list all the blog posts on a particular blog would be a GET on /blogs/{blogId}/posts. 3. Base URIs define the web uri location where the resources are available through the endpoints. To take a real example, for Google blogger the base_uri is https://www.googleapis.com/blogger/v3. 4. HTTP Methods is where the simplicity of REST lies. In RESTful API design, operations on resources are done through the standard HTTP methods, primarily GET, POST, PUT and DELETE . Other HTTP methods - OPTIONS, HEAD, PATCH are also used in some cases.

    0 讨论(0)
  • 2021-01-29 21:16

    SOAP vs REST Web Services

    1) SOAP is a protocol whereas REST is an architectural style.

    2) SOAP can't use REST because it is a protocol whereas REST can use SOAP web services because it is a concept and can use any protocol like HTTP, SOAP.

    3) SOAP uses services interfaces to expose the business logic whereas REST uses URI to expose business logic.

    4) SOAP defines standards to be strictly followed whereas REST does not define too much standards like SOAP.

    5) SOAP requires more bandwidth and resource than REST whereas REST requires less bandwidth and resource than SOAP.

    6) SOAP defines its own security while RESTful web services inherits security measures from the underlying transport.

    7) SOAP permits XML data format only whereas REST permits different data format such as Plain text, HTML, XML, JSON etc.

    RESTful web services are heavily preferred over SOAP web services.

    0 讨论(0)
  • 2021-01-29 21:21

    REST conforms to nothing more than the http protocol.

    0 讨论(0)
  • 2021-01-29 21:24

    One of the objectives of REST is cachability, for that the resource needs to be identified by the uri (query string). In soap the request is posted, therefor for different requests you have the same uri and thus the resource cannot be uniquely identified by the ur

    0 讨论(0)
  • 2021-01-29 21:32

    REST and SOAP are not equivalent concepts.

    REST:

    • Depends on one transport protocol (HTTP).
    • Makes full use of the specific features of that protocol (verbs GET, POST, PUT, DELETE, caching, headers, and predefined error codes).
    • Says nothing about the format of the messages passed back and forth. However, since the HTTP verb and URL already define the action to take, the message body must therefore contain only the data.
    • Message security is provided by the transport protocol (HTTPS), and is point-to-point only. If you want to secure the message end-to-end, you have to do it yourself.
    • Originally intended for simple CRUD operations on objects.

    SOAP:

    • Independent of the transport protocol (could be HTTP, FTP, TCP, UDP, named pipes, shared memory or even email).
    • Requires only that the transport protocol be able to send and receive text (e.g. on HTTP, only the POST verb is used).
    • Strictly defines the format of the messages passed back and forth. A SOAP message contains the data, the action to perform on it, the headers, and the error details in case of failure.
    • Message security is provided by the WS-* standards, and is end-to-end.
    • Originally intended for arbitrary RPC calls.

    Items 2 and 3 in the above lists are the main points of incompatibility.

    0 讨论(0)
提交回复
热议问题