Skip to Content

Failed to load https:/************.xsjs/collection:

Nov 27, 2017 at 06:53 AM


avatar image

Hi Folks,

I tried to read the data from oData service URL. Below is controller code and the error in the console.

Failed to load https:/************.xsjs/collection: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.

var serviceURI = "https://**************.xsjs/";

var username = "*********";

var password = "**********";

var OData = new sap.ui.model.odata.ODataModel(serviceURI,true ,username,password);"/Collection", {
   success: function(oData) {

Please check the code and error and tell me the resolution.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Mantri Shekar Nov 27, 2017 at 10:26 AM

Hi Arvind

It looks like the service you are consuming is xsjs Service.

When you are trying to consume xsjs service you have two options.

1)Consume it through AJAX Call or

2)Consume it using sap.ui.model.json.JSOnModel().

But you are consuming them using OData Model which is not used for consuming xsjs service.If your service is .xsodata then you can consume it using OData Model,if your service is .xsjs then you consume the service using sap.ui.model.json.JSONMOdel().



10 |10000 characters needed characters left characters exceeded