Use the proxy server that comes with SAP Fiori Tools to solve cross-domain problems encountered by locally running SAP UI5 applications when accessing remote services Trial version

The SAP UI5 application we deployed to run in the local development environment 浏览器安全策略cannot directly access the remote OData service due to the limitation. The reason is that our SAP UI5 application runs locally on localhostthis domain name, and the domain name of the OData service requested by the remote end, for example services.odata.org, The two are not the same domain name. Due to the browser security policy, the browser rejects this 跨域的HTTP access request.

The author's A set of step-by-step learning tutorials for SAP UI5 developers has introduced many different ways to solve the problems encountered in the local development of SAP UI5 applications 跨域问题.

The author of this article introduces another method, using the proxy server middleware (middleware) that comes with SAP Fiori Tools, developers do not need to develop proxy servers by themselves, nor do they need to download third-party proxy servers and install them locally. Simply perform simple configuration directly in the SAP UI5 local project ui5.yamlfile .

The example based on this step is still step 24, which is to consume remote OData services https://services.odata.org/V2/Northwind/Northwind.svc/.

In step 24, we directly disabled the security check policy of the Chrome browser. In the other tutorial articles mentioned above, the author uses a custom or third-party proxy server to avoid errors in cross-domain access to OData services.

Let's first look at the effect achieved after completing the steps described in this article.

Whether the local SAP UI5 application running on localhost can successfully access the OData service https://services.odata.orgon , and retrieve the invoice list and display it in the form control of the application.

The following is a detailed implementation process explanation of this step.

Guess you like

Origin blog.csdn.net/i042416/article/details/130535215