Hi!
I have published a Microsoft Dynamics NAV page as an OData web service V4.
*This post is locked for comments
Hello, can you pls tell me if there is away to fetch metadata of a single service? instead of all services
Also is it possible to fetch this data in json instead of xml?
TIA :)
Totally agree.. this web services seem completely useless. Have not found any tool that will generate a usable proxy. There should be an easy way to consume a Page web service from .net or .net core, but I haven't found any examples.
Also the metadata page will show hundred web services if you have hundred published. There seems to be no way to reference a single service.
Hello Cyril,
I have not used those v4 options but will check into it and let you know but in the meantime I think to get the data in json format you can use format option. Please check below link.
Hi Suresh,
Long time no see :-) I am the customer that ZnowDog develops for.
We want to use V4 as it gives json and not xml for our client apps. You see the url in attached picture and everything works for that service except fetching the data.
Rgds
Cyril
Padon me, but I am not sure how you are referring OData as V4 service of NAV, when I published myservices on NAV they are available on localhost/.../OData so i just used that on my service reference. It is NAV 2017.
What is specific about ODatav4 and how did you get the url thehost/.../odatav4
Hi!
So you used the built in Add Service Reference in Visual Studio with a OData v4 Service from Nav?
Can you show me the document you get when surfing to your /Odata? Are you sure this is v4 version and you are using NAV 2017? Its enough with the start of it to verify that we get the same thing.
I do not need to use the OData Client Proxy Generator if Add Service Reference works. Maybe I need an update of Visual Studio? I am not sure there is one though for this.
When I surf to my "/Odatv4" i get a document like this :
{ "@odata.context":"http://thehost:7058/nav17livews/odatav4/$metadata","value":[ { "name":"Accounting_Periods","kind":"EntitySet","url":"Accounting_Periods" },{ "name":"Apply_Customer_Entries","kind":"EntitySet","url":"Apply_Customer_Entries" },{ "name":"Cash_Receipt_Journal","kind":"EntitySet","url":"Cash_Receipt_Journal" },{ "name":"Chart_Of_Accounts","kind":"EntitySet","url":"Chart_Of_Accounts"
If I surf to
http://thehost:7058/nav17livews/odatav4/$metadata
I get:
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0"> <edmx:DataServices> <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="NAV"> <EntityType Name="Accounting_Periods"> <Key> <PropertyRef Name="Starting_Date"/> </Key> <Property Name="Starting_Date" Type="Edm.DateTimeOffset" Nullable="false"
None of those documents work for me when I add them as Reference and try to generate
//ZD
Znow,
I have not used client code generator, but i just added the following url as Service Reference in my class library localhost/.../OData which gave me the services available and i have chosen the service.
Do you need to use Odata Client Code Generator
Trying to use that with Client Proxy Generator for Odata v4 gives me:
Severity Code Description Project File Line Suppression State Error Running transformation: System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlReader.MoveToContent() at System.Xml.Linq.XElement.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XElement.Parse(String text, LoadOptions options) at System.Xml.Linq.XElement.Parse(String text) at Microsoft.VisualStudio.TextTemplating9C75E0AB9F6D19DBF8364854AEAFBAA5A943565337DA61D507EE5CF3AC07E75E057D01AB48915DE0CDB25B3B11EFC2A9F16F67802022C4CC61781567F3D1D43F.GeneratedTextTransformation.CodeGenerationContext..ctor(String edmx, String namespacePrefix) in :line 560 at Microsoft.VisualStudio.TextTemplating9C75E0AB9F6D19DBF8364854AEAFBAA5A943565337DA61D507EE5CF3AC07E75E057D01AB48915DE0CDB25B3B11EFC2A9F16F67802022C4CC61781567F3D1D43F.GeneratedTextTransformation.CodeGenerationContext..ctor(Uri metadataUri, String namespacePrefix) in :line 547 at Microsoft.VisualStudio.TextTemplating9C75E0AB9F6D19DBF8364854AEAFBAA5A943565337DA61D507EE5CF3AC07E75E057D01AB48915DE0CDB25B3B11EFC2A9F16F67802022C4CC61781567F3D1D43F.GeneratedTextTransformation.TransformText() in :line 67 560
That is not a metadocument?
Are you using this URL thehost/.../odatav4$metadata when you add to the service reference ?
you need to use thehost/.../OData
Sohail Ahmed
2
mmv
2
Amol Salvi
2