4

据我了解,我需要使用WADL来描述一个 RESTful Web 服务。尽管如此,我还是在相关帖子中阅读了很多答案,其中用户强烈反对使用 WADL。

WADL的缺点是什么?有没有替代的解决方案?

4

1 回答 1

4

The HTTP spec tells you how to retrieve and update resources. Resources are identified by URIs and should be linked together, so all data should be discoverable from the service root url, just like pages on a web site. What that leaves is for you to document the media-types that you are transferring across the wire.

If you take this approach and you reuse media-types across services then you only need to document the media type once and it will be applicable for all services.

Once you have done those steps there is really nothing left for WADL to document.

If you want to do REST you cannot use WADL to code generate clients, as that creates a tight coupling between client and server. If that's ok with you, fine, but just realize that you are not doing REST and therefore will not realize some of the benefits of REST.

于 2010-06-17T22:44:55.340 回答