与 SOAP 不同,为什么 REST 不使用 WSDL? [英] Why doesn't REST utilize WSDLs, unlike SOAP?

查看:37
本文介绍了与 SOAP 不同,为什么 REST 不使用 WSDL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于 SOAP Web 服务,有一个所有请求/响应都必须遵循的规范.该规范采用 WSDL 文档的形式.但是对于 REST Web 服务,为什么没有这样的规范或 WSDL?这是否会使 REST 更容易受到运行时异常的影响,因为我们没有遵循任何规范?

For SOAP web services there is a specification which all request/responses must follow. This specification is in the form of a WSDL document. However for REST web services, why is there no such specification or WSDL? Does this make REST more vulnerable to runtime exceptions because we are not following any specifications?

推荐答案

REST 实际上只使用 HTTP 动词 (GET, PUT, POST>, DELETE, ...) 在资源上.资源上的所有操作都应该以这种方式表示.POST 当您无法以适合其他三个的方式表达您的业务逻辑时,可以将其用作全部内容.这就是为什么没有真正用于 REST 服务的 WSDL,因为资源上只有 4 个方法.

REST really only uses the HTTP verbs (GET, PUT, POST, DELETE, …) on a resource. All operations on a resource are supposed to be represented that way. POST is used as a catch all for when you can't express your business logic in a way that fits into the other three. That is why there isn't really a WSDL for a REST service since you only ever have 4 methods on the resource.

但是您仍然可以使用 WSDL 2.0 描述 REST Web 服务的可能性.

这篇关于与 SOAP 不同,为什么 REST 不使用 WSDL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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