Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

sap.ui.model.odata.ODataModel sending a OPTIONS request type to OData producer

$
0
0

Hello,

 

I've been trying to implement a sample consumer of OData content (using the sample Northwind services) , however, i've run into a peculiar issue with the ODataModel constructor itself.

 

It would seem that the constructor function for sap.ui.model.odata.ODataModel is sending a "OPTIONS" request type, which is not supported by the consumer.

 

<!DOCTYPE html>

<html><head>

  <meta http-equiv='X-UA-Compatible' content='IE=edge' />

  <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

  <title>test</title>

  <script id='sap-ui-bootstrap' type='text/javascript'

  src='/sapui5/resources/sap-ui-core.js'

  data-sap-ui-theme='sap_goldreflection'

  data-sap-ui-libs='sap.ui.commons,sap.ui.ux3'></script>

  <!-- add 'sap.ui.table' and/or other libraries if required -->

  <script>

  var oModel = new sap.ui.model.odata.ODataModel("http://services.odata.org/v3/odata/odata.svc");

  </script>

</head>

<body class='sapUiBody'>

  <div id='content'></div>

</body>

</html>

 

The above code returns a HTTP Error Code 501. Because it is sending a OPTIONS request to http://services.odata.org/v3/odata/odata.svc

 

  1. OPTIONS http://services.odata.org/v3/odata/odata.svc/$metadata 501 (Not Implemented) datajs.js:17
  2. OPTIONS http://services.odata.org/v3/odata/odata.svc/$metadata 501 (Not Implemented) datajs.js:17
  3. XMLHttpRequest cannot load http://services.odata.org/v3/odata/odata.svc/$metadata. Invalid HTTP status code 501 datajs.js:17
  4. 2014-01-03 09:00:51 [051c0997-f5ca-491d-aaee-c3ac3d694dfb] The following problem occurred: A network error occurred. - 

 

I have tried to inittialize the OData model withouth any URL, the call the read function, however, the constructor throws an error "Uncaught TypeError: Cannot call method 'indexOf' of null"

 

Of course i can use the $format=json flag to retrieve data via an AJAX request, but i should be able to use the regular library.

 

Please let me know if there is any way of circumventing this request type, I don't see any in the documentation.

 

Regards, Rafael.


Viewing all articles
Browse latest Browse all 6178

Trending Articles



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