I want to use breeze with odata service: http://services.odata.org/V3/OData/OData.svc
breeze.config.initializeAdapterInstances({dataService: "OData"});
var ms = new breeze.MetadataStore();
ms.fetchMetadata("http://services.odata.org/V3/OData/OData.svc")
.then(function(rawMetadata) {...});
or, like this:
breeze.config.initializeAdapterInstances({dataService: "OData"});
var em = new breeze.EntityManager("http://services.odata.org/V3/OData/OData.svc");
em.fetchMetadata()
.then(function(rawMetadata) {...});
But, as I see breeze tries to fetch odata in json format when this service supports only atom/xml metadata.
Response header:
Content-Type:application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Error message:
OPTIONS http://services.odata.org/V3/OData/OData.svc/$metadata. 501 Not Implemented
XMLHttpRequest cannot load http://services.odata.org/V3/OData/OData.svc/$metadata. Invalid HTTP status code 501
When I call this URL with jQuery, everything goes fine:
$.ajax({
url: 'http://services.odata.org/V3/OData/OData.svc/$metadata',
dataType: 'xml',
type: 'GET'
}).done(function(data, st, xhr) {...});
and this scenario works too:
OData.defaultHttpClient.formatQueryString = '$format=application/json;odata=fullmetadata';
OData.defaultHttpClient.enableJsonpCallback = true;
OData.read("http://services.odata.org/V3/OData/OData.svc/Products",
function (data, response) { alert(data.results[0]); },
function (err) { alert(err.trace); }
);
but this scenario doesn't work:
OData.read("http://services.odata.org/V3/OData/OData.svc/$metadata",
function (data, response) { alert(data.results[0]); },
function (err) { alert(err.trace); },
OData.metadataHandler);