【发布时间】:2014-10-14 15:27:19
【问题描述】:
我对 oData 网络服务很陌生。我想在移动平台上获取并填充以下输出。我可以在移动平台 http://services.odata.org/V4/Northwind/Northwind.svc/Customers 上填充以下 url 数据。然而,一旦我开始做另一个练习。我坚持以下 odata 输出。如何访问属性,例如名称或描述?
PUT /OData/OData.svc/Products(1) HTTP/1.1 Host: services.odata.org DataServiceVersion:
1.0 MaxDataServiceVersion: 2.0 accept: application/atom+xml
content-type: application/atom+xml Content-Length: 1181
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Entry xml:base="http://services.odata.org/OData/OData.svc/"
xmlns:d=" http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m=" http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns="http://www.w3.org/2005/Atom">
<id>http://services.odata.org/OData/OData.svc/Products(1)</id>
<title type="text"></title>
<updated>2010-02-28T10:23:02Z</updated>
<author>
<name />
</author>
<Link rel="edit" title="Product" href="Products(1)" />
<category term="DataServiceProviderDemo.Product"
scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:ID m:type="Edm.Int32">1</d:ID>
<d:Name>Milk</d:Name>
<d:Description>Low fat milk</d:Description>
<d:ReleaseDate m:type="Edm.DateTime">1995-10-21T00:00:00</d:ReleaseDate>
<d:DiscontinuedDate m:type="Edm.DateTime" m:null="true" />
<d:Rating m:type="Edm.Int32">4</d:Rating>
<d:Price m:type="Edm.Decimal">4.5</d:Price>
</m:properties>
</content>
</Entry>
【问题讨论】:
-
您的问题是您想使用原子有效负载更新 services.odata.org/v4/odata/odata.svc/ 中的实体并得到错误吗?什么是访问属性?似乎是一个不同的问题。您能否详细说明您的场景和遇到的问题? :)
-
我想获取 ID、名称、描述、ReleaseDate、Discontunie、Rating、Price 属性。
-
我感到困惑的原因是您附加的输出中的 HTTP 动词是“PUT”。好的,现在我想我知道该怎么回答了:)
-
请继续,很抱歉让易丁感到困惑:-)
标签: odata