RESTful Services - WSDL Equivalent

RestWsdl

Rest Problem Overview


I have been reading about REST and SOAP, and understand why implementing REST can be beneficial over using a SOAP protocol. However, I still don't understand why there isn't the "WSDL" equivalent in the REST world. I have seen posts saying there is "no need" for the WSDL or that it would be redundant In the REST world, but I don't understand why. Isn't it always useful to programmatically bind to a definition and create proxy classes instead of manually coding? I don't mean to get into a philosophical debate, just looking for the reason there is no WSDL in REST, or why it is not needed. Thanks.

Rest Solutions


Solution 1 - Rest

The Web Application Description Language (WADL) is basically the equivalent to WSDL for RESTful services but there's been an ongoing controversy whether something like this is needed at all.

Joe Gregorio has written a nice article about that topic which is worth a read.

Solution 2 - Rest

WSDL describes service endpoints. REST clients should not be coupled to server endpoints (i.e. should not be aware of in URLs in advance). REST clients are coupled on the media-types that are transfered between the client and server.

It may make sense to auto generate classes on the client to wrap around the returned media-types. However, as soon as you start to create proxy classes around the service interactions you start to obscure the HTTP interactions and risk degenerating back towards a RPC model.

Solution 3 - Rest

RSDL aims to turn rest like a hypermedia, in other words, it has more information than a service descriptor like WSDL or WADL. For example, it has the information about navigation, like hypertext and hyperlinks.

For example, given a current resource, you have a set os links to another resources related.

However, i didn't find Rest Clients that supports this format or Rest Server Solutions with a feature to auto generate it.

I think there is a long way for a conclusion about it. See the HTML long story and W3C vs Browsers lol.

For more details about Rest like Hypermedia look it: http://en.wikipedia.org/wiki/HATEOAS

Note : Roy Fielding has been criticizing these tendencies in Rest Apis without the hypermidia approach: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven

My Conclusion : Now a Days, WADL is more common that Rest and Integration Frameworks like Camel CXF already supports WADL ( generate and consume ), because it is similar to WSDL, therefore most easy to understand in this migration process ( SOAP to REST ).

Let's see the next chapters ;)

Solution 4 - Rest

> Isn't it always useful to programmatically bind to a definition and > create proxy classes instead of manually coding?

Agree wholeheartedly, this is why I use Swagger.io

> Swagger is a powerful open source framework backed by a large > ecosystem of tools that helps you design, build, document, and consume > your RESTful APIs.

So basically I use Swagger to describe my models, endpoints, etc, and then I use other tools like swagger-codegen to generate the proxy classes instead of manually coding it.

See also: RAML

Solution 5 - Rest

There is an RSDL (restful service description language) which is equivalent to WSDL. The URL below describes its practice http://en.wikipedia.org/wiki/HATEOAS and http://en.wikipedia.org/wiki/RSDL. The problem is that we have lots of tool to generate code from wsdl to java, or reverse. But I didn't find any tool to generate code from RSDL.

Solution 6 - Rest

WSDL is extensible to allow description of endpoints and their messages regardless of what message formats or network protocols are used to communicate

However, REST uses the network protocol by using HTTP verbs and the URI to represent an objects state.

WSDLs tell you at this place, if you send this message, you'll perform this action and get this format back as a result.

In REST, if I wanted to create a new profile I would use the verb POST with a JSON body or http server variables describing my profile to the URL /profile

POST should return a server-side generated ID, using the status code 201 CREATED and the header Location: *new_profile_id* (for example 12345)

I can then perform updates changing the state of /profile/12345 using the HTTP verb POST, say to change my email addresss or phone number. Obviously changing the state of the remote object.

GET would return the current status of the /profile/12345

PUT is usually used for client-side generated ID

DELETE, obvious

HEAD, gets the status without returning the body.

With REST it should be self-documenting through a well designed API and thus easier to use.

This is a great article on REST. It really help me understand it too.

Solution 7 - Rest

WSDL 2.0 specification has added support for REST web services too. Best of both worlds scenario. Problem is WSDL 2.0 is not widely supported by most tools out there yet. WSDL 2.0 is W3C recommended, WSDL1.1 is not W3C recommended but widely supported by tools and developers. Ref: http://www.ibm.com/developerworks/library/ws-restwsdl/

Solution 8 - Rest

The Web Application Description Language (WADL) is an XML vocabulary used to describe RESTful web services.

As with WSDL, a generic client can load a WADL file and be immediately equipped to access the full functionality of the corresponding web service.

Since RESTful services have simpler interfaces, WADL is not nearly as necessary to these services as WSDL is to RPC-style SOAP services.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionskazView Question on Stackoverflow
Solution 1 - RestjoschiView Answer on Stackoverflow
Solution 2 - RestDarrel MillerView Answer on Stackoverflow
Solution 3 - RestEduardo FabricioView Answer on Stackoverflow
Solution 4 - RestAlex NolascoView Answer on Stackoverflow
Solution 5 - RestrichardView Answer on Stackoverflow
Solution 6 - RestroderView Answer on Stackoverflow
Solution 7 - RestsupernovaView Answer on Stackoverflow
Solution 8 - RestJSSView Answer on Stackoverflow