Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

Error while connecting with the url using odata...please help

$
0
0

hi All,

 

I was trying to do one basic ODATA example which i got from the threads.

 

<!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>Table with OData Binding</title>

 

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

        src='https://sapui5.hana.ondemand.com/resources/sap-ui-core.js'

        data-sap-ui-libs="sap.m,sap.ui.commons,sap.ui.table"

  data-sap-ui-theme="sap_bluecrystal"></script>

 

  <script>

  // the root URL of the OData service - prefixed with a local URL to a proxy which forwards the request,

 

 

circumventing cross-domain restrictions

  // IMPORTANT: this proxy must be available for the code example to run!

  var url = "http://services.odata.org/Northwind/Northwind.svc";

 

 

// create an ODataModel from URL

  var oModel = new sap.ui.model.odata.ODataModel(url, true);

 

  var oTable = new sap.ui.table.Table("sampleTable");

 

  oModel.read("/Customers",null,null,null,function(){

 

  var metadata = oModel.getServiceMetadata();

  var entityCustomerRef = metadata.dataServices.schema[0].entityType[2];

  var listOfProperties = entityCustomerRef.property;

 

  for ( var i = 0; i < listOfProperties.length; i++) {

  oTable.addColumn(new sap.ui.table.Column().setLabel(

  new sap.ui.commons.Label({

  text : listOfProperties[i].name,

  })).setTemplate(

  new sap.ui.commons.TextField().bindProperty("value",

  listOfProperties[i].name))) }

  oTable.setModel(oModel); // set model to Table

  oTable.bindRows("/Customers");

 

 

  });

 

 

  oTable.placeAt("content"); // place model onto UI

 

  </script>

 

  </head>

  <body class='sapUiBody'>

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

  </body>

</html>

 

 

but when i try to execute the same it is not loading any data and showing the error as :

 

 

2014-07-21 16:04:05 (default) : https://sapui5.hana.ondemand.com/resources/ - sap.ui.ModuleSystem sap-ui-core.js:80

 

2Failed to load resource: the server responded with a status of 501 (Not Implemented) http://services.odata.org/Northwind/Northwind.svc/$metadata

XMLHttpRequest cannot load http://services.odata.org/Northwind/Northwind.svc/$metadata. Invalid HTTP status code 501 odata.html:1

  1. 2014-07-21 16:04:16 The following problem occurred: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://services.odata.org/Northwind/Northwind.svc/$metadata'. -  sap-ui-core.js:80
Failed to load resource: the server responded with a status of 501 (Not Implemented) http://services.odata.org/Northwind/Northwind.svc/CustomersXMLHttpRequest cannot load http://services.odata.org/Northwind/Northwind.svc/Customers. Invalid HTTP status code 501 odata.html:1
  1. 2014-07-21 16:04:17 The following problem occurred: HTTP request failed0,, -  sap-ui-core.js:80;;
  2.  

 

But i can launch the url with metadata through browser..kindly help???


Viewing all articles
Browse latest Browse all 2823

Trending Articles



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