您需要 RESTful Web 服务接口吗?
我正在为我的论文构建一个简单的 RESTful Web 服务,也许这是一个圆顶问题,但我只是想知道,您真的需要一个接口(WADL 或 WSDL)来创建客户端吗?可能是通过 SOAP Web 服务!谢谢
I'm busing to build a simple RESTful webservice for my thesis, maybe this is a dome quetion but I just want to know, do you really need an interface (WADL or WSDL) to create clients? Likely by SOAP webservice! Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
SOAP Web 服务通常不是 RESTful。如果您要提供 SOAP API:是的,您需要提供 WSDL 文件。这使得 Web 服务的使用者能够从 WSDL 生成使用者代码。
RESTful 服务是否真的需要 WADL 还不太明确:
如果有人能够使用该服务,您确实需要以某种方式记录该服务 就我个人而言,我认为有比 WADL 更好的方法来记录 RESTful API。
A SOAP web service is typically not RESTful. If you're providing a SOAP API: yes, you need to provide a WSDL file. This enables consumers of the web service to generate consumer code from the WSDL.
Whether or not WADL is really needed for a RESTful service is less clear-cut:
You do need to document the service in some way if anyone is going to be able to use it. Personally, I think there are better ways to document a RESTful API than WADL.
不,你不知道。即使使用 SOAP,您也并不真正需要接口 - 您只需提供一个知道如何与您的服务通信的“客户端 SDK”,但有一些标准(WSDL 和 MEX)用于声明SOAP 中的接口。
对于 REST 服务,由于 WADL 并未得到广泛采用,最常见的情况是您向服务的用户提供一组人类可读的示例,说明如何使用您的服务。
No, you don't. Even with SOAP you don't really need an interface - you can just ship a "client SDK" which knows how to talk to your service, but there are a few standards (WSDL and MEX) for declaring an interface in SOAP.
With REST services, since WADL isn't widely adopted, the most common scenario is that you'd present the users of your service with a human-readable set of examples of how to use your service.
肥皂:是的。
REST:不。您始终可以使用 RestSharp 之类的东西来使用它们。
要使用 SOAP,您的客户端需要了解 SOAP 以及它通过 SOAP 接收哪些对象,因此需要 WSDL。
SOAP: Yes.
REST: No. You can always use something like RestSharp to consume them.
To use SOAP your client needs to understand SOAP and what objects it's receiving via SOAP so WSDL is required.
在 REST 模型中,“接口”将是超媒体(请参阅 http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven)。
例如,在网站上,界面就是网页 (HTML) 本身。
WADL 试图为机器消费提供类似的东西。还可能有其他形式的接口:XForms、RDF(和 RDF 表单 )。在某些情况下,SOAP 也可能是合适的(例如与 WSRF 结合)。
In the REST model, the "interface" will be the hypermedia (see http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven).
For example, on a web site, the interface will be the web-page (HTML) itself.
WADL is an attempt to provide something similar for machine consumption. There could also be other forms of interfaces: XForms, RDF (and RDF forms). In some cases, SOAP may also arguably be suitable (e.g. combined with WSRF).