20

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, why is there no such specification or WSDL? Does this make REST more vulnerable to runtime exceptions because we are not following any specifications?

Panzercrisis
  • 4,590
  • 6
  • 46
  • 85
Victor
  • 16,609
  • 71
  • 229
  • 409

3 Answers3

23

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

You can find more info here on my blog post.

Praveen
  • 2,039
  • 14
  • 15
15

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.

TheEwook
  • 11,037
  • 6
  • 36
  • 55
  • 21
    The suggestion that something like WSDL isn't needed for REST services because of the use of the standard HTTP verbs is misleading. The reality is that in general you cannot count on different REST implementations to use HTTP in the same way at all, and HTTP verbs don't tell you anything about the representations they act on. So, for any given REST service, there is a tremendous vacuum of information about how to use it, leaving implementers to develop some out-of-band means for describing it, ranging from "read our documentation" to "poke around with your browser and figure it out". – Hoobajoob Apr 16 '14 at 17:53
6

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

Nabi K.A.Z.
  • 9,887
  • 6
  • 59
  • 81