Friday, 11 July 2014

Do we need WSDL to describe a RESTful Web service?

Someone shared an article written by IBM engineer (link). They want to use WSDL2.0 to describe the RESTful Web Service. I do not think it is necessary to use WSDL2.0 to describe RESTful service although WSDL2.0 can do that. At least, it is too early to apply this idea into real project before it is widely adopted in industry and code generating tool is given.

First of all, one of major reason for us to use RESTful is that RESTful is simpler than SOAP. In other words, RESTful is more about expose resource through Web server. SOAP based WS serves more as RPC. RESTful and SOAP have different design styles and they focus on different application domain. RESTful is mainly used to execute CRUD methods over HTTP with verb POST, GET, PUT, DELETE respectively. So, RESTful did not use WSDL to describe its service from the begin.

Secondly, there is no handy tool like WSDL2Java or WSDL2PHP for converting RESTful WSDL to be a computing code. Axis2 probably convert RESTful request into WSDL internally before it will further process the request. But, this happens internally.

Thirdly, since RESTful is simple. We can mainly use totally four diagrams to describe a RESTful service. Since we can make a human reading friendly document, why do we need to "go back" to WSDL, which is not fully understood by many programmer. Actually, SOAP WS programmer can still code before he fully understands the WSDL as he has handy tools to help him. We can probably call WSDL as machine reading language. Below is a simple diagram example to describe a RESTful GET method to a resource.


Therefore, I do not think it is good idea to describe RESTful WS in WSDL as WSDL is a kind of machine reading language. We do not need WSDL for RESTful before we get code generating tool for converting WSDL2.0 to to real code and code to WSDL2.0.

Also, it will misguide if designer treat RESTful as a RPC. For my opinion, a designer can treat RESTful WS as static Web content from a Web server. SOAP (WSDL) based Web service services as RPC more. Therefore, a designer can see whether he can model the application as a resource or not as a start point to think about using RESTful or SOAP or other RPC protocols. So, not to think RESTful WS as a RPC will definitely help Web Service designer to keep in right rack.
see the below link if you want to see rest over soap
http://javadeveloperchoiceno1.blogspot.in/2014/07/web-services-rest-vs-soap.html

No comments:

Post a Comment