iDatamining.org

I am looking for projects to work on
Please contact with me at yiyu.jia@iDataMining.org!

Wednesday, November 17, 2010

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.

4 comments:

  1. are you sure about this ... since how will an end programmer know what and how to call ... ?

    ReplyDelete
    Replies
    1. How many programmers like to directly read WSDL file? WSDL is more like a machine language. There could be different ways to describe a RESTful service. It is possible to use WSDL to describe RESTful. But, is it still WSDL or just another XML file? What will be the purpose for using WSDL for RESTful? Make it complicate? Or, make it to be understood by another application (not a programmer)?

      Delete
  2. jia i agree your opinion. i don't know why they are using wsdl for REST. no tool available for consuming rest wsdl. so why we have describe REST in WSDL.

    ReplyDelete
    Replies
    1. Hi Sabari, thanks for comments. I actually have not update this blog for a while. Glad to see somebody will agree with me :)

      Yes. it was funny somebody told me he want to use WSDL for RESTful service. However, we have another type of document called WADL that is designed for RESTful and it could be useful, at least in the Java world.

      Delete