从 Eclipse 使用 OData [英] Consuming OData from Eclipse

查看:35
本文介绍了从 Eclipse 使用 OData的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用文档练习 SAPUI5,但他们使用 SAP Web IDE 来使用 OData 服务.但是,因为我的公司不会将他们的服务器暴露在云端,所以我不能使用 SAP Web IDE,所以我需要使用 eclipse.我需要一个教程一步一步(对于傻瓜)来使用来自 Eclipse 的 SAPUI5 的 OData.我已经知道如何创建它们,但不知道如何从 Eclipse 中使用它们.

I've been practicing SAPUI5 with the documentation but they use SAP Web IDE to consume OData services. However, because my company won't expose their server to the cloud, I can't use SAP Web IDE so I need to use eclipse. I need a tutorial step by step (for dummies) for consuming OData with SAPUI5 from eclipse. I already know how to create them but not how to use them from eclipse.

我使用 Northwind 的 OData 服务,但使用 SAP,我需要凭据和其他东西.

I use the OData service from Northwind but with SAP, I'll need credentials and other things.

"dataSources": {
  "invoiceRemote": {
    "uri": "https://services.odata.org/V2/Northwind/Northwind.svc/",
    "type": "OData",
    "settings": {
      "odataVersion": "2.0"
    }
  }
}

推荐答案

一个使用 Northwind 的 OData 的例子:(这是我在 eclipse 中实现的,但与 sap web ide 个人版的唯一区别(我还没有尝试过)但它应该可以工作)您必须为服务配置目标文件)

An exmaple using th OData of northwind: (this i made it in eclipse but the only differece with sap web ide personal edition (i haven't try this yet but it should work) you must configure the destination file for the services)

manifest.json

manifest.json

 //between sap.app key you put this:
            "dataSources": {
            "mainService": {
                "uri": "/northwind/V2/OData/OData.svc/",
                "type": "OData",
                "settings": {
                    "odataVersion": "2.0",
                    "localUri": "localService/metadata.xml"
                }
            }
        }

...
// this can be empty the if your using more than two just one can be empty
"": {
            "dataSource": "mainService",
            "preload": true
        }

我认为我将使用这些数据:

In my view that i'm going to use the data:

<List
                id="list"
                items="{
                    path: '/Categories',
                    sorter: {
                        path: 'Name',
                        descending: false
                        },
                    groupHeaderFactory: '.createGroupHeader'
                }"
                busyIndicatorDelay="{masterView>/delay}"
                noDataText="{masterView>/noDataText}"
                mode="{= ${device>/system/phone} ? 'None' : 'SingleSelectMaster'}"
                growing="true"
                growingScrollToLoad="true"
                updateFinished="onUpdateFinished"
                selectionChange="onSelectionChange">
                <infoToolbar>
                    <Toolbar
                        active="true"
                        id="filterBar"
                        visible="{masterView>/isFilterBarVisible}"
                        press="onOpenViewSettings">
                        <Title
                            id="filterBarLabel"
                            text="{masterView>/filterBarLabel}" />
                    </Toolbar>
                </infoToolbar>
                <items>
                    <ObjectListItem
                        type="Active"
                        press="onSelectionChange"
                        title="{Name}">
                    </ObjectListItem>
                </items>
            </List>

如果您要使用和为您制作的 odata 或消费,只需将 url 粘贴到 yo key dataSource 的属性uri"中(类似这样:https://proxy/name:port/sap/opu/odata/SAP/ZNAME_OF_YOUR_CREATED_ODATA_SRV" 别担心这个网址是您可以在/IWFND/MAINT_SERVICE 时看到它)并且何时已经部署它,只需像这样离开 uri/sap/opu/odata/SAP/ZNAME_OF_YOUR_CREATED_ODATA_SRV

If you're going to use and odata made for you or consume just paste the url in the propertie "uri" of yo key dataSource (something like this: "https://proxy/name:port/sap/opu/odata/SAP/ZNAME_OF_YOUR_CREATED_ODATA_SRV" don't worry this url is you could see it when yo /IWFND/MAINT_SERVICE ) and when is already to deploy it just leave the uri like this /sap/opu/odata/SAP/ZNAME_OF_YOUR_CREATED_ODATA_SRV

这篇关于从 Eclipse 使用 OData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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