REST Web 服务 WSDL? [英] REST web service WSDL?

查看:33
本文介绍了REST Web 服务 WSDL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实现一个 Web 服务,并且我已经实现了 REST 和 SOAP 版本,以查看哪个版本适合我的需求.我决定选择 REST,因为它很简单,而且我可能会开发一个 iPhone 应用程序来使用它.我的问题真的很简单,是否可以为我的 REST 服务创建 WSDL 或 WADL,是否有必要?

I am implementing a web service and I have implemented both a REST and SOAP version to see which suited my needs.I have decided to choose REST because of its simplicity and that I will probably be developing an iPhone app to consume it. My question is simple really, is it possible to create a WSDL or WADL for my REST service and is it necessary?

谢谢

推荐答案

有了好的 RESTful 服务,就没有必要为它生成 WADL(更不用说不太合适的 WSDL)了,因为它会自我描述.我所说的自我描述"是指它将提供描述服务发布的所有(相关)资源的文档,并且对这些资源中的任何一个使用标准 HTTP OPTIONS 请求将产生有关如何交互的基本信息.使用 WADL 的唯一真正好处是它允许调用者提前发现它需要处理的复杂文档的模式;REST 本身并没有提供任何帮助(并且一些 REST 支持者认为这样做会适得其反,我不确定我是否同意).

With a good RESTful service, it's not necessary to generate WADL (let alone the much-less-well-fitting WSDL) for it because it will self-describe. By "self-describe" I specifically mean that it will deliver documents describing all the (relevant) resources published by the service, and that using a standard HTTP OPTIONS request on any of these will produce basic information about how to interact. The only real benefit to using WADL is that it allows the caller to discover the schemas for the complex documents it needs to work with ahead of time; REST itself provides no help there (and some RESTians believe that doing such things is counter-productive, which I'm not sure I agree with).

当然,这并没有捕捉到更深层次的交互模式,但绝大多数 WSDL 服务描述也没有捕捉到,所以那里没有变化.

Of course, that doesn't capture the deeper interaction patterns, but neither do the vast majority of WSDL descriptions of services so no change there.

作为记录,我使用 Apache CXF 创建 RESTful 服务(使用 JAX-RS)并为它们发布 WADL.

For the record, I use Apache CXF to create RESTful services (using JAX-RS) and that publishes WADL for them.

这篇关于REST Web 服务 WSDL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆