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

查看:152
本文介绍了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天全站免登陆