mod*_*diX 6 cordova hana sapui5
我们的客户已将其系统更改为SAP,并希望应用程序通过SAP界面显示数据.我们决定使用SAPUI5框架+ WebIDE来开发应用程序,因为它提供了非常好的控件种类,具有可靠的MVC设计以及用于SAP界面的易于使用的云连接器.
我们已经配置了这样的连接器:
新app.json
{
"welcomeFile": "/webapp/index.html",
"routes": [
{
"path": "/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
},
{
"path": "/test-resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/test-resources"
},
"description": "SAPUI5 Test Resources"
},
{
"path": "/mynews",
"target": {
"type": "destination",
"name": "MyNews_CMS",
"preferLocal": true
}
}
],
"sendWelcomeFileRedirect": true
}
Run Code Online (Sandbox Code Playgroud)
这是我们在component.js中的测试调用:
try {
$.get("/mynews/?json=2", function(data, status) {
alert("success: " + JSON.stringify(data));
}).fail(function(arg1) {
alert("error: " + JSON.stringify(arg1));
});
} catch (err) {
alert("global error: " + err);
}
Run Code Online (Sandbox Code Playgroud)
在我们的WebIDE中,我们获得了包含来自SAP连接器API的所有需要数据的完整JSON,但是,只要我们构建应用程序并使用HAT(Android,iOS,甚至已签名)在任何设备上发布它,请求就会失败.
首先,它警告{}(空对象),然后它发出警报error: {"readyState":0,"status":0,"statusText":"error"}
我们如何解决这个问题?
小智 -1
这neo-app.json与您的 UI5 应用程序无关。甚至不需要让应用程序运行,因为只有 SAP WebIDE 会解释并使用此文件进行配置。
你真正想做的是在你的 : 中定义你的目的地manifest.json:
...
"dataSources": {
"ODataEndpoint": {
"uri": "https://yourappname.hana.ondemand.com/your/odata/path/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "/your/odata/path/"
}
}
}
...
"models": {
"": {
"dataSource": "ODataEndpoint"
}
}
...
Run Code Online (Sandbox Code Playgroud)
如果这不起作用,您应该调试设备的网络活动以查看调用了哪个 URL。
如何在 iOS 应用程序内调试网络调用:https://cordova.apache.org/docs/en/latest/guide/next/#ios-debugging
如何在 Android 应用程序内调试网络调用: https://cordova.apache.org/docs/en/latest/guide/next/#chrome-remote-debugging
| 归档时间: |
|
| 查看次数: |
279 次 |
| 最近记录: |