Skip to Content

GW ODATA on SAP HANA XS in SAPUI5

Hello,

I am designing a SAPUI5 Application on SAP HANA XS in which I want to use a ODATA service from separate Gateway Server (using http). I tried by passing credentials also in OData Model but still call is unsuccessful.

I am testing this in Google Chrome and no pop-up comes to enter Credentials.

var url ="http://hostname:50000/sap/opu/odata/sap/ZDEMO_ODATA_SRV/";

var oModel = new sap.ui.model.odata.ODataModel(url,false,"Username" ,"Passsowrd");

//Also tried :
//var oModel = new sap.ui.model.odata.ODataModel(url,false,{user:"Username"
// ,password:"Passsowrd"});

		    var	path = "/REG_SalesSet";
			var that = this;
			
oModel.read(path, null, function(oData, oResponse){
	var model = new sap.ui.model.json.JSONModel(oData.results);
		this.setModel(model);
			});
capture.png (21.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 29, 2017 at 12:35 PM

    normally if your app is hosted in serverA, you can only call odata service from serverA. if you want to call odata from serverB, you need proxy to do the job for you.

    google SOP, CORS

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Jun,

      I have already tried all possible solutions for CORS -

      1. proxy/http/hostname:port/sap/opu/odata/sap/ZDEMO_ODATA_SRV/

      2. Enabled CORS extension in Google Chrome

      3. tested in Goggle Chrome by launching it using --disable-web-security

      But nothing worked.

      Regards,

  • avatar image
    Former Member
    Aug 29, 2017 at 03:33 PM

    you can install a chrome plugin name as "CORS" and turn the setting ENABLE. It will work.

    Add comment
    10|10000 characters needed characters exceeded