Open Sarika-Sita opened 2 years ago
Looks pretty self explanatory to me.. it's saying it can't obtain the metadata from the odata service because the service requires authentication. If you browse to the metadata endpoint yourself to get the metadata document (you'll have to authenticate with the odata service) then save this document to a file, then run this extension and use the option to select the metadata from the file instead.
If we could get the option to add a custom header to the $metadata call, it would solve this problem. The Microsoft OData Connected Service extension allows this.
This is off topic, but the MS extension has other problems related to BC though, which this extension shares because the generated code use the same change tracker that pushes the entire object instead of just the changed properties. 'id' is readonly..
I am unable to add the Reference for ODATA service published from MS Business Central.
Following is the message after pressing finish.
Adding service instance... Adding Nuget Packages for OData V4... Nuget Package "Microsoft.OData.Client" for OData V4 already installed. Nuget Package "Microsoft.OData.Core" for OData V4 already installed. Nuget Package "Microsoft.OData.Edm" for OData V4 already installed. Nuget Package "Microsoft.Spatial" for OData V4 already installed. Nuget Packages for OData V4 were installed. Generating Client Proxy for OData V4... Error:Adding Unchase OData Connected Service to the project failed: Failed to access the metadata document. The OData service requires authentication for accessing it. Please download the metadata, store it into a local file, and set the value of “MetadataDocumentUri” in the .odata.config file to the file path. After that, run custom tool again to generate the OData Client code.
Steps to reproduce
It must connect with Web Service. But it is showing above error. I am following following MS document.
https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/webservices/authenticate-web-services-using-oauth
I checked the issue in Github with below link as well but no help.
https://github.com/unchase/Unchase.Odata.Connectedservice/issues/35