We are developing a application using SAPUI5 Development Kit ver 1.12. The Data is obtained from a Netweaver Gateway system. When the SAPUI5 Framework instantiates the ODataModel Object it attempts to make a connection to the URI which has been specified in the URL.
In Chrome ver 27, when the oDATAModel Object is instantiated, this leads to a OPTIONS request going to the Netweaver Gateway. i.e. the Request Method in the HTTP Header is OPTIONS and not GET or PUT. This OPTIONS request fails with HTTP error code 401, Unauthorized.
The oData Service requires Authentication before it can be used.
We are passing the Username and password while creating the oDataModel Object, i.e. in its constructor. Also our Sync is not Asynchronous.
The JS code snippet from the View is given below
var oDATAServiceURL = "http://server/ias_relay_server/client/rs_client.dll/ODATAFARM/sap/opu/odata/sap/Z_OURSERVICE";var oDATAServiceUserName = "NetWeaverGatewayUserID";var oDATAServicePassword = "PasswordOfNetWeaverGatewayUserID";var myODATAModel = new sap.ui.model.odata.ODataModel(oDATAServiceURL, false, oDATAServiceUserName, oDATAServicePassword, null);
Can anybody let me know what do I have to do to resolve this issue?