0

I am trying to use BreezeJS with an existing OData server, that was implemented using .NET System.Services.Data.DataService, Version 4.0. As it seems, BreezeJS is doing a http OPTIONS request to get $metadata, but the server throws a NotImplemented exception. When I manually request $metadata using http GET in the browser, I am getting (XML formatted) metadata fine.

Is there a way to configure Breeze to use http GET or would I need to somehow adjust the server to support http OPTIONS?

Any help would be appreciated.

user1211286
  • 681
  • 5
  • 17

1 Answers1

0

The OPTIONS request is part of CORS, as explained in this answer. You need to configure your server to support CORS, or don't use cross-origin requests from the browser.

See this answer and this answer regarding using WCF with CORS. It seems the recommendation is to switch to Web API.

Community
  • 1
  • 1
Steve Schmitt
  • 3,124
  • 12
  • 14
  • This seems to be correct, but confuses me. Breeze claims to support OData V1/V2 ("odata"), V3 ("webApiOData") as well as V4 ("webApiOdata4", preliminary, but the docs may be outdated) with different adapters. The links seem to indicate that Breeze does not work with V1/V2 (WCF DataServices) due to the lack of CORS support, which can only be achieved by moving to Web API. This may be a limitation of either datajs and/or Odata on the server side, though. – user1211286 Sep 06 '16 at 08:27
  • The support for CORS needs to come on the server side. Do you need CORS support in your application? – Steve Schmitt Sep 06 '16 at 19:21
  • I was not even aware of CORS until this matter came up. The server is an existing software, running as a Windows service and providing odata on a given port. The angular/breeze client for now is being developed and test-driven using lite-server, obviously on a different port, but on the same machine. Any hints whether changing settings would somehow recolve the issue? – user1211286 Sep 07 '16 at 06:02
  • Obviously the simple solution is to run everything on the same port. If you can't do that, maybe you could have a passthrough service on your web server that basically proxies requests through to the odata service. To the browser, it would look like all requests are going to the same place. – Steve Schmitt Sep 07 '16 at 15:56