[英]How do I interact with OData from Java?
OData is Microsoft's repackaging of its Astoria (now WCF Data Services) RESTful query/update protocol. OData是微软重新打包其Astoria(现在的WCF数据服务)RESTful查询/更新协议。 If I want to use Java to create an OData compatible data source, how do I do that? 如果我想使用Java创建兼容OData的数据源,我该怎么做? Similarly, if I want to consume an OData data source from Java, how do I do that? 同样,如果我想从Java使用OData数据源,我该怎么做?
http://www.odata.org/ http://www.odata.org/
Partial answer below. 部分答案如下。
The OData website suggests that Restlet supports OData. OData网站建议Restlet支持OData。 Restlet's API documentation mentions the org.restlet.ext.odata package. Restlet的API文档提到了org.restlet.ext.odata包。
www.restlet.org/ www.restlet.org/
www.restlet.org/documentation/snapshot/jee/ext/org/restlet/ext/odata/package-summary.html www.restlet.org/documentation/snapshot/jee/ext/org/restlet/ext/odata/package-summary.html
Is this the only answer? 这是唯一的答案吗? Are there blog posts on doing this integration? 有没有关于这种整合的博客文章?
还有odata4j 。
There is a olingo library in java which can be used for RESTful communication with Odata protocol. java中有一个olingo库,可用于与Odata协议进行RESTful通信。
you can refer the following link for the reference: https://olingo.apache.org/doc/odata4/index.html 您可以参考以下链接作为参考: https : //olingo.apache.org/doc/odata4/index.html
You can find the source code for sample project too from the above link. 您也可以从上面的链接中找到示例项目的源代码。
Any Java library that can consume an Atom feed will be able to read an OData source. 任何可以使用Atom提要的Java库都可以读取OData源。 Any Java library that can perform the Atom pub protocol will be able to update an OData service. 任何可以执行Atom pub协议的Java库都可以更新OData服务。
What you will not be able to do out of the box is perform queries and access the EDM properties. 您无法开箱即用的是执行查询并访问EDM属性。 Depending on how loosely coupled you need to be this will either be really easy to do or damn difficult. 根据您需要的松散耦合程度,这将非常容易做到或者很难。 If you can survive coupling your client to the service then it should be pretty easy with any XML parser to pull the data out of the OData entry. 如果您能够将客户端与服务耦合起来,那么任何XML解析器都可以非常轻松地将数据从OData条目中提取出来。
There is a Microsoft blog post with various pointers to OData interoperability resources: 有一篇Microsoft博客文章,其中包含指向OData互操作性资源的各种指示:
OData interoperability with .NET, Java, PHP, iPhone and more OData与.NET,Java,PHP,iPhone等的互操作性
See this: http://blog.noelios.com/2010/03/15/restlet-supports-odata-the-open-data-protocol/ and this: http://wiki.restlet.org/docs_2.0/13-restlet/28-restlet/287-restlet/288-restlet.html 请参阅: http : //blog.noelios.com/2010/03/15/restlet-supports-odata-the-open-data-protocol/以及: http : //wiki.restlet.org/docs_2.0/ 13-的Restlet / 28的Restlet / 287-的Restlet / 288-restlet.html
Also there is a growing list of information on OData here: http://odata.org/developers/odata-sdk 此外,有关OData的信息列表越来越多: http : //odata.org/developers/odata-sdk
hope this helps 希望这可以帮助
Alex 亚历克斯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.