cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 use odata error

0 Kudos

As title,

I am practicing SAPUI5 according to the example provided by the official(https://sapui5.hana.ondemand.com/#/topic/44062441f3bd4c67a4f665ae362d1109), but in step 26, CORS will appear when using remote ODATA

((I use Visual Studio Code for practice

How to solve this situation?

Accepted Solutions (0)

Answers (4)

Answers (4)

ricardo7227
Participant

I just had that problem until a few days ago.

What I did was use this package:

ui5-middleware-proxy-basicauth

in the ui5.yaml file you declare the url of the service.

ç

in the manifest we need to declare the datasource and with it, we can work normally.

we launch the application and the first call to the metadata connects successfully.

0 Kudos

Thank for your answer!

I have some questions,What value needs to be filled in uri (as shown below)

In the official tutorial, this value needs to be filled in the odata URL.

former_member466198
Participant

Hi Tim,

try this:

https://blogs.sap.com/2019/01/07/cors-and-fioriui5-everything-you-need-to-know/

or, in the same link that you have shared, there is a solution inside, just scroll below and there are 3 ways to solve it.

geert-janklaps
Active Contributor

Hi,

This is explained in the URL you're using. (scoll all the way down)

You can choose one of these options to solve this:

Best regards,

Geert-Jan Klaps

0 Kudos

Thanks for your answer!

I have tried the following way, I have tried using SAP WEB IDE personal edition, but "access denied" appears when I execute ORION, and I have used the incognito window, but it has no effect.

In addition, I also tried to change my browser to avoid CORS and use www.proxy-anywhere.com/xxxx but it didn’t work.

geert-janklaps
Active Contributor
0 Kudos

Hi,

Did you create a destination file for your local Web IDE?

https://help.sap.com/viewer/825270ffffe74d9f988a0f0066ad59f0/CF/en-US/2cf47f37e34c428c97a51057733c03....

Best regards,

Geert-Jan Klaps

0 Kudos

Hi,

I have reinstalled SAP WEB IDE Personal Edition,It can log in successfully, but Orion is not SAP WEB IDE.

So,I have reference to the following QA solution,but it can't find the page.

SAP Web IDE Personal Edition: "Access Denied" when logging in

ricardo7227
Participant
0 Kudos

(Original Answer - He does not let me answer in the comment, so I do it here)

Hi.

ok, let's say we want to consume from this url:

https://services.odata.org/V2/Northwind/Northwind.svc/

For this we go to ui5.yaml and declare the base of the url and mountPath.

baseUri: https://services.odata.org
mountPath: /mySuperOdataService (it is a value that we define and is used for the package to identify to which baseUri it has to make the request)

With this, we only need to declare the path to the odata in the manifest:

"uri": "/mySuperOdataService/V2/Northwind/Northwind.svc/"

With this you have everything ready to work locally..