Restful 与其他 Web 服务 [英] Restful vs Other Web Services

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

问题描述

Restful 网络服务与 SOAP 等其他网络服务有何不同?

解决方案

关于 Web 服务的争论绝不是完整的,但有一些元素很突出.

RESTful Web 服务是 Web 服务的家族".有些人会称之为架构.

RESTful Web 服务使用 HTTP 协议来执行来自 Web 服务的请求.他们使用 HTTP 动词:GET、POST、PUT 和 DELETE(有时还有其他动词).请求本身指向代表资源的 URL……有时请求会在正文中包含数据,这些数据可能是 HTML、JSON、二进制数据或其他.

纯粹的 RESTful Web 服务只需要 URL 和 HTTP 动词来描述请求的操作...正文数据通常是要参与请求的操作的有效负载...它不应该指示请求的操作

另一方面,SOAP 实际上是一种协议.它通常通过 HTTP 传输,但 HTTP 请求只是一种将 SOAP 数据包送到必要处理程序的方法.SOAP 请求的内容描述了客户端想要执行的操作.它包含所有必要的信息.

它们是实现 Web 服务的两种截然不同的方式.如果你问哪个更好"这个问题,你可能会得到双方的强烈意见.我建议您进一步调查并做出自己的决定.

What does it make Restful webservices different from the other Web Services like SOAP?

解决方案

The debate over web services is by no means complete, but there are some elements that stand out.

RESTful web services are a 'family' of web services. Some would call it an architecture.

RESTful web services use the HTTP protocol to perform requests from a web service. They use the HTTP verbs: GET, POST, PUT and DELETE (and others, sometimes). The requests themselves are to URLs which represent resources... sometimes the requests will contain data in the body that could by HTML, JSON, binary data or other.

A purely RESTful web service only requires the URL and the HTTP verb to describe the requested action... the body data is usually a payload to be involved in the requested action... it should not dictate the requested action

SOAP, on the other hand, is actually a protocol. It is usually transported over HTTP, but the HTTP request is just a method to get the SOAP packet to the necessary handler. The contents of the SOAP request describes what the client wants performed. It contains all the necessary information.

They are two very different ways of implementing Web Services. If you ask the question "Which is better" you'll probably get strong opinions from both sides. I suggest you investigate further and make up your own mind.

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

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