简体   繁体   English

无法访问SAP UI5中的OData

[英]Cannot access odata in sap ui5

I have my odata which is hosted from java spring boot application in backend. 我的odata由后端的java spring boot应用程序托管。 I am trying to access it from my SAP UI5 application the odata url by creating an odata model i get the following error. 我试图通过创建odata模型从我的SAP UI5应用程序访问odata url,但出现以下错误。

var oModel = new sap.ui.model.odata.ODataModel("'myodataurl'/odata.svc/Users");
Error in console:

OPTIONS "myodataurl"/odata.svc/Users/$metadata 501 (Not Implemented)

XMLHttpRequest cannot load "myodataurl"/odata.svc/Users/$metadata. Response to
preflight request doesn't pass access control check: No 'Access-Control-Allow-
Origin' header is present on the requested resource. Origin 'myurl' is 
therefore not allowed access. The response had HTTP status code 501.request.

Your service URL is probably just myodataurl/odata.svc . 您的服务URL可能只是myodataurl/odata.svc Please try that. 请尝试一下。 The URL myodataurl/odata.svc/Users is the URL to your entityset Users. URL myodataurl/odata.svc/Users是您的实体集用户的URL。

And delete the single ticks around myodataurl . 并删除myodataurl周围的单个刻度。

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

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