OData和REST Web服务之间的区别 [英] Difference between OData and REST web services

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

问题描述

在研究某些Web服务时,我遇到了Microsoft称为 OData 的新"技术.通过阅读FAQ中有关OData是什么的通篇,我很难区分OData和REST-ful Web服务. 有人可以帮我理解差异吗?

While looking into some web services, I ran across this "new" technology that Microsoft is calling OData. Reading through their description within the FAQ on what OData is, I am having a hard time distinguishing OData from REST-ful web services. Could someone please help me understand the differences?

推荐答案

更新警告,由于OData V4可用,此答案已经过时了.

UPDATE Warning, this answer is extremely out of date now that OData V4 is available.

不久前,我在此处上写了一篇关于该主题的文章

I wrote a post on the subject a while ago here.

正如Franci所说,OData基于Atom Pub.但是,他们将某些功能置于顶层,但不幸的是,在此过程中他们忽略了一些REST约束.

As Franci said, OData is based on Atom Pub. However, they have layered some functionality on top and unfortunately have ignored some of the REST constraints in the process.

OData服务的查询功能要求您基于不可用或未链接到响应的信息来构造URI. REST人们称之为带外信息,并引入了客户端和服务器之间的隐藏耦合.

The querying capability of an OData service requires you to construct URIs based on information that is not available, or linked to in the response. It is what REST people call out-of-band information and introduces hidden coupling between the client and server.

引入的另一种耦合是通过使用EDMX元数据来定义条目内容中包含的属性.可以在称为$ metadata的固定端点处发现此元数据.再次,客户端需要事先知道这一点,无法发现它.

The other coupling that is introduced is through the use of EDMX metadata to define the properties contained in the entry content. This metadata can be discovered at a fixed endpoint called $metadata. Again, the client needs to know this in advance, it cannot be discovered.

不幸的是,Microsoft认为创建媒体类型来描述这些关键数据是不合适的,因此任何OData客户端都必须对正在与之通信的服务以及正在接收的数据做出一系列假设.

Unfortunately, Microsoft did not see fit to create media types to describe these key pieces of data, so any OData client has to make a bunch of assumptions about the service that it is talking to and the data it is receiving.

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

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