cancel
Showing results for 
Search instead for 
Did you mean: 

get error CORS header 'Access-Control-Allow-Origin' missing SAPUI5 ?

Former Member
0 Kudos

hi, i am new in SAPUI5. for this case i want to show data from Odata net waver in the eclipse application for SAPUI5, but i got a problem when i trying to run program.

this is sctructure tree from eclipse

and this is code from controller:

onInit: function() {

  var oModel = new sap.ui.model.odata.ODataModel

  ("http://[hostname]:8000/sap/opu/odata/SAP/ZEMP_SRV/EmployeeSet", true, "basisadm", "passw0rd" );

  oModel.attachRequestSent(function() { 

  console.log("Request sent"); 

         //etc 

     }); 

     oModel.attachRequestCompleted(function() { 

   console.log("Request completed"); 

         //etc 

     }); 

     oModel.attachRequestFailed(function() { 

   console.log("Request failed"); 

         //etc 

     }); 

  sap.ui.getCore().setModel(oModel);

  },

i get this error from mozilla firefox when program running.

how i solve this and whats i missing?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor

if you have your gateway server, just deploy and run. don't try hard, waste time.

RohitAggarwal
Explorer
0 Kudos

Hi,

Is this issue has been resolved? I am facing the same issue when calling the Odata service from the local host application.

We have the SAP Gateway Hub. its working fine when calling from the Postman or any other Rest client.

Appreciate your responses.

Thanks you,

Rohit

Former Member
0 Kudos

sorry for late response. this link helpful to solve the problem

SAPUI5 - CRUD Operations Part 3 - Creating our view - YouTube

Answers (2)

Answers (2)

CarlosRoggan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

for those of you who still searching for a solution:
Use App Router to solve CORS
Use Proxy Server to solve CORS
(works locally and in Cloud)

Cheers,
Carlos

Former Member
0 Kudos

Hi,

Fo testing in local only, you can use CORS pluging CORS Everywhere :: Modules pour Firefox