简体   繁体   English

用于SOAP的WSDL和基于JSON的REST和REST的WSDL

[英]WSDL for SOAP and WSDL for REST and REST based on JSON

when a company wants to release a web services, does it release a separate WSDL for SOAP and separate for REST based web services or they are merged in the same WSDL? 当公司想要发布Web服务时,它是否为SOAP发布单独的WSDL并为基于REST的Web服务单独发布,还是在同一个WSDL中合并? Can a WSDL only represent REST web services based on JSON (not XML) ? WSDL只能代表基于JSON(而不是XML)的REST Web服务吗?

Assume web services clients are Java based. 假设Web服务客户端是基于Java的。

If SOAP and REST are merged in the same WSDL, does wsimport generates separate classes (for binding XML to Java objects) for SOAP and separate for REST? 如果SOAP和REST在同一个WSDL中合并,那么wsimport是否为SOAP生成单独的类(用于绑定XML到Java对象),并为REST分开?

You need WSDL 2.0 (or WADL) to describe REST service. 您需要WSDL 2.0(或WADL)来描述REST服务。 Support for WSDL 2.0 is currently very limited and wsimport doesn't support it. 目前对WSDL 2.0的支持非常有限,wsimport不支持它。 I'm not Java developer but I think that wsimport is only for SOAP services (JAX-WS and it doesn't support WSDL 2.0 as well). 我不是Java开发人员,但我认为wsimport仅适用于SOAP服务(JAX-WS,它也不支持WSDL 2.0)。

Edit: 编辑:

Check this extension . 检查此扩展程序 It should allow you exposing JAX-WS service with JSON encoding. 它应该允许您使用JSON编码公开JAX-WS服务。 It should also expose "JavaScript proxy" for calling the JSON service. 它还应该公开“JavaScript代理”来调用JSON服务。 To more precisely answer your question - I don't think that you can describe REST service without WSDL 2.0 or WADL. 为了更准确地回答您的问题 - 我认为您不能在没有WSDL 2.0或WADL的情况下描述REST服务。 So you cannot merge SOAP and REST service to single WSDL 1.1 supported by most stacks. 因此,您无法将SOAP和REST服务合并到大多数堆栈支持的单个WSDL 1.1。 For further reference about describing JSON service check this question . 有关描述JSON服务的进一步参考,请检查此问题

Can a WSDL only represent REST web services based on JSON (not XML) WSDL是否只能表示基于JSON(而不是XML)的REST Web服务

WSDL 2 can describe XML by defining the XML types using a schema. WSDL 2可以通过使用模式定义XML类型来描述XML。 See this introduction on WSDL 2 for REST . 请参阅WSDL 2 for REST的这篇介绍

Although, TBH I've never written WSDL for REST before, I just publish the URLs and the schemas for the types. 虽然,我以前从未为REST编写WSDL,但我只是发布了类型的URL和模式。

Since the tooling isn't quite there yet, I doubt many are using SOAP and HTTP bindings in a single WSDL. 由于工具尚未完全存在,我怀疑许多人在单个WSDL中使用SOAP和HTTP绑定。 Although both can be represented in a WSDL 2.0, and at the same time, since most folks rely on tooling to manage their WSDLs today (and the rest of the WS stack), they probably simply don't bother and leave their WSDLs alone. 虽然两者都可以在WSDL 2.0中表示,但同时,由于大多数人依靠工具来管理他们的WSDL(以及WS堆栈的其余部分),他们可能根本就不会费心并且只留下他们的WSDL。

Also, most REST people are building their clients by hand, rather than relying on tooling and WSDLs, so those folks aren't currently "missing" the tooling and support for this. 此外,大多数REST人员都在手工构建客户,而不是依赖于工具和WSDL,因此这些人目前并没有“缺少”工具和支持。

When the tools catch up on both the server and client side, then there will likely be more adoption in practice for HTTP service bindings in WSDL 2.0. 当工具在服务器端和客户端都赶上时,实际上可能会更多地采用WSDL 2.0中的HTTP服务绑定。 Whether the idiom will be to conflate the to specs in to a single WSDL or not, remains to be seen. 这个成语是否会将规范与规范混为一谈,还有待观察。

If they want to host them on the same end points, then they likely will. 如果他们想要在相同的终点上托管他们,那么他们可能会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM