我一直在用文档练习SAPUI5,但是他们使用SAPUI5来使用OData服务。但是,由于我的公司不会将他们的服务器暴露给云,所以我不能使用SAP,所以我需要使用eclipse。我需要一步一步的教程(对于虚拟人)来使用来自eclipse的OData和SAPUI5。我已经知道如何创建它们,但不知道如何从eclipse中使用它们。
我使用来自Northwind的OData服务,但是对于SAP,我需要凭据和其他东西。
"dataSources": {
"invoiceRemote": {
"uri": "https://services.odata.org/V2/Northwind/Northwind.svc/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
}
}发布于 2018-03-06 12:15:08
使用北风的th OData的示例:(这是在eclipse中实现的,但它是与sap web ide个人版的唯一区别(我还没有试过,但它应该能工作)您必须为服务配置目标文件)
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
}在我看来,我将使用这些数据:
<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>如果您要使用和使用为您制作的数据或消费,只需将url粘贴在yo key dataSource的属性" uri“中(类似于:"SRV”-请不要担心这个url是您可以在yo /IWFND/MAINT_SERVICE时看到的),以及何时部署它,只需将uri保留为这个SRV
发布于 2018-02-22 22:41:20
..。因为他们不会向云公开他们的服务器,所以我不能使用SAP
基于clould的Web的另一种选择是Web个人版,您可以在本地计算机上部署它,但它仍然在浏览器(localhost)中运行。创建一个相应的目标文件来连接到远程系统,其余的与云中原有的基于Orion的Web基本相同。
以下是来自odata.org的服务的目标文件(例如Northwind)
Description=OData service from odata.org for testing, tutorials, demos, etc.
Type=HTTP
Authentication=NoAuthentication
WebIDEUsage=odata_gen
Name=odata_org
WebIDEEnabled=true
URL=http\://services.odata.org/
ProxyType=Internet
WebIDESystem=odata_org否则,如果您想继续使用eclipse,请查看文档主题。
发布于 2018-02-22 18:53:52
我会给你一些灯光,但不是一个完整的教程。
在eclipse中工作与使用WEB没有多大区别。首先,您需要使用JSONModel()。您可以找到参考这里。
创建一个JSONModel对象,然后使用loadData方法。对于sURL的使用(在您的示例中):"https://services.odata.org/V2/Northwind/Northwind.svc/?$format=json“
然后,您的oData将在您的前端。现在,您只需要学习如何在视图元素中使用它。你可以学习它,这里。
如果你想要进一步的解释,请提出一些小而具体的问题,这样就更容易根据你的需要来回答了。
https://stackoverflow.com/questions/48934468
复制相似问题