简体   繁体   English

如何在Android上创建用于访问OData服务的代理

[英]how to create a Proxy for accessing OData Service on android

I'm new to android and i am following this tutorial to access an OData service on android. 我是android新手,我正在按照本教程访问android上的OData服务。 I am stuck where I have to make a proxy to access the Odata service. 我被困在必须创建代理才能访问Odata服务的位置。 can anyone tell me how to make a proxy? 谁能告诉我如何制作代理? the tutorial says to develop it using: 本教程说要使用以下方法进行开发:

IDataServiceProxy proxy = new DataServiceAtomPubProxyImpl(DataServiceClient.URL); IDataServiceProxy代理=新的DataServiceAtomPubProxyImpl(DataServiceClient.URL);

i have tried to include it in my MainActivity.java but it is not working. 我试图将其包含在MainActivity.java中,但无法正常工作。 Can you tell me where are these classes defined: IDataServiceProxy, DataServiceAtomPubProxyImpl , DataServiceClient. 您能告诉我这些类在哪里定义:IDataServiceProxy,DataServiceAtomPubProxyImpl,DataServiceClient。 ? and how to proceed on with making a proxy for my android app? 以及如何继续为我的Android应用制作代理?

The example does not explain this, but it is actually quite simple: 该示例没有解释这一点,但实际上非常简单:

If you look into the files you imported from the java-project, you should have one file named something like: " MyData OdataAppService.java ". 如果查看从java项目导入的文件,则应该有一个名为类似文件:“ MyData OdataAppService.java ”。 This is your service, not the other files you see in the example. 这是您的服务,而不是您在示例中看到的其他文件。

To get the service you simply create a new instance of this: 要获得服务,您只需创建一个新的实例:

MyDataOdataAppService service = new MyDataOdataAppService (); MyDataOdataAppService服务=新的MyDataOdataAppService();

... then you can run service.createMyItemQuery("............"); ...然后您可以运行service.createMyItemQuery(“ ............”);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM