cancel
Showing results for 
Search instead for 
Did you mean: 

Getting CORS Error while calling Northwind Service

Yash_Sharma
Explorer
0 Kudos
206

Hi Experts,

I am facing problem of getting CORS error while calling Northwind oData Service to show data in my SAPUI5 Application created in BAS.
I am using 2 approaches here:
1. By Using the Rest API

Yash_Sharma_0-1723451923091.png

  By directly calling the Service URL through ODataModel, I am getting CORS error on this but while disabling the browser security I am getting the data perfectly. 

2. By Configuring the  Northwind Service to the Destination in BTP and try using the destination.

Yash_Sharma_1-1723452117813.png

manifest.json

Yash_Sharma_2-1723452215683.pngYash_Sharma_3-1723452294301.png

xs-app.json

Yash_Sharma_4-1723452347331.png

since the preload is true, the destination is loading first to fetch the metadata,

I am getting this:

Yash_Sharma_5-1723452451833.png

Please help me with this. 

 

View Entire Topic
Akhilesh_u
Explorer

Hi,

1- direct url wont work here, and also if you use http://services.odata.org in your destination then also it will give CORS issue.

2- this is fine just you need to remove destination name from the uri in manifest file, it should be like below,

"dataSources": {
    "mainService": {
        "uri": "/V2/Northwind/Northwind.svc/",
        "type": "OData",
        "settings": {
            "annotations": [],
            "localUri": "localService/metadata.xml",
            "odataVersion": "2.0"
        }
    }
}

hope this helps.

Yash_Sharma
Explorer
0 Kudos
Thanks @Akhilesh_u, worked for me