Why doesn't REST utilize WSDLs, unlike SOAP?

前端 未结 3 1433
醉话见心
醉话见心 2020-12-23 15:02

For SOAP web services there is a specification which all request/responses must follow. This specification is in the form of a WSDL document. However for REST web services,

相关标签:
3条回答
  • 2020-12-23 15:36

    SOAP is a protocol.
    REST is an architecture.

    In many references you will see REST and SOAP both mentioned as competitors. That is not true. SOAP is actually a protocol, not an architecture style. What REST can be compared against is SOA and RPC. All three are examples of web service styles, each with their own conceptual focus. RPC is focused around operations, SOA around messages, and REST around resources. (ref)

    So for SOAP, wrote WSDL document standards. But for REST there is not a standard document, but there is many the best practices be like http://jsonapi.org

    0 讨论(0)
  • 2020-12-23 15:42

    REST really only uses the HTTP verbs (GET, PUT, POST, DELETE, …) on a resource. All operations on a resource are supposed to be represented that way. POST is used as a catch all for when you can't express your business logic in a way that fits into the other three. That is why there isn't really a WSDL for a REST service since you only ever have 4 methods on the resource.

    But you still have the possibility to describe a REST web service with WSDL 2.0.

    0 讨论(0)
  • 2020-12-23 15:48

    There are bunch of ways to define a RESTful API just like WSDL for SOAP:

    • Google Discovery service format.
    • Mashery IODocs.
    • WADL.
    • Swagger.
    • Apiary.

    You can find more info here on my blog post.

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