Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9052

OData.request 401 Unauthorized

$
0
0

Hi Experts,

 

I am working on login authentication service where i am trying to get data from oData service.

 

While running this odata service in chrome it is reverting actual and correct data but wrapping it up in ajax request or any other request eg : oData request "401 Unauthorized" error is coming.

 

Code is as follows:

 

sap.ui.controller("odatabinding.TablewithODATA", {

  onInit: function() {

  var oModel = new sap.ui.model.json.JSONModel();

  var URI = encodeURI("https://<server>:<port>/gateway/odata/SAP/LOGIN_WITH_FIXED_USER/InspectionSet");

  $.ajax({

  url: URI,

  success: function(result){

  var data = result.value;

  oModel.setData(data);

  }

  });

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

  },

});

 

I am aware of the fact that oData model should be used in this case but while checking in debugger error for result prevails. Which means request is not being hit.

 

Thanks in advance.

 

Regards,

Shalini Mathur


Viewing all articles
Browse latest Browse all 9052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>