简体   繁体   English

从SAP Web IDE中的两个不同系统访问OData服务

[英]Access OData services from two different system in SAP Web IDE

I have two OData services on two different systems, for which I have added destinations in HCP and entries in neo-aap.json file. 我在两个不同的系统上有两个OData服务,我已经在HCP中添加了目标,在neo-aap.json文件中添加了条目。

{
    "path": "/sap/opu/odata",
    "target": {
        "type": "destination",
        "name": "ABC",
        "entryPath": "/sap/opu/odata"
    },
    "description": "ABC"
}, {
    "path": "/sap/opu/odata",
    "target": {
        "type": "destination",
        "name": "XYZ",
        "entryPath": "/sap/opu/odata"
    },
    "description": "XYZ"
}

With this, I'm able to access only one system's service ie OData service which is on ABC . 有了这个,我只能访问一个系统的服务,即ABC上的OData服务。 When app loads app tries to load hit metadata for 2nd OData service as well in ABC which is obviously not there, hence fails. 当应用程序加载应用程序尝试加载第二个OData服务的命中元数据以及ABC显然不存在时,因此失败。

How do I access the OData service on XYZ system? 如何在XYZ系统上访问OData服务?

If the 'path' is the same, only the first one will be matched. 如果'path'相同,则只匹配第一个。 Set different paths for your destinations. 为目的地设置不同的路径。 The 'path' property in the neo-app.json is just an alias for your destinations. neo-app.json中的'path'属性只是目的地的别名。 With your config, this means, whenever in your app, you request something from '/sap/opu/odata/... ' the application will overwrite this part of the path with the URL you configured in the Destination. 使用您的配置,这意味着,无论何时在您的应用中,您从'/ sap / opu / odata / ...'请求某些内容,应用程序将使用您在Destination中配置的URL覆盖路径的这一部分。

Just make something like this: 做这样的事情:

{
  "path": "/ABC/sap/opu/odata",
  "target": {
     "type": "destination",
     "name": "ABC",
     "entryPath": "/sap/opu/odata"
  },
  "description": "ABC"
}, {
  "path": "/XYZ/sap/opu/odata",
  "target": {
     "type": "destination",
     "name": "XYZ",
     "entryPath": "/sap/opu/odata"
  },
  "description": "XYZ"
}

And then make sure you use "/ABC/sap/opu/odata" or "/XYZ/sap/opu/odata" whenever you set your model data sources. 然后确保在设置模型数据源时使用“/ ABC / sap / opu / odata”或“/ XYZ / sap / opu / odata”。

This, from my perspective, is a bug. 从我的角度来看,这是一个错误。 The key used for locating the destination is the " path " value so you will always hit the first destination. 用于定位目标的键是“ path ”值,因此您将始终到达第一个目的地。 You can resolve this by changing the path from /sap/opu/odata to /sap/opu/odata1 You then edit your dataSources in your manifest.json: adjust the " uri " with the adjusted path on any models you are trying to point to the 2nd path. 您可以通过将/sap/opu/odata的路径更改为/sap/opu/odata1来解决此问题。然后在manifest.json中编辑dataSource:在您尝试指向的任何模型上使用调整后的路径调整“ uri ”到第二条路。

I have written on this here and am busy trying to get SAP to change this behaviour. 我已经在这里写了这篇文章并且正在努力让SAP改变这种行为。

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

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