Consume OData Service from Visual Studio 2017

2k views Asked by At

I've a issue consuming Dynamics Nav OData. I'm using Visual Studio Community 2017 (version 15.9.0), and I've installed the extension OData Connected Service (Official Microsoft Extension)1.

Extension installed at Visual Studio

This is my Odata structure:

http://myWeb:8145/DynamicsNav90_Desa/OData

I've verified and the odata is returning 2 values correctly at opera browser.

OData Respone

So far, it's working fine.

The problem is when I go to the visual studio and I try to add a new connected service, It throws the next error 3:

Odata ERROR

Image text:

Connected Services Cannot access http://myWeb:8145/DynamicsNav90_Desa/OData/$metadata

I've checked the firewall and the port information and they are totally open to connect.

1

There are 1 answers

2
Adrian Bystrek On BEST ANSWER

I had the same issue (I'm also working with Dynamics Nav ;) )

The problem is that OData Connected Service doesn't support authorization.

You need to save metadata file locally and point it when adding OData Service Reference.

  1. Open http://myWeb:8145/DynamicsNav90_Desa/OData/$metadata in the browser and save it on disk
  2. Use path to this file during adding service reference in Visual Studio: List item

For me it works perfectly.