Fetching $metadata for a specific collection or entity with Odata web services in Microsoft Dynamics NAV 2016

穿精又带淫゛_ 提交于 2019-12-01 09:38:44
John Slegers

As @xuzhg suggested in the comments and as is indicated by Github issues like Support Metadata as a service (#181), it appears that the Odata $metadata are not really a dynamic service. Instead, it's just a single XML file.

This explains not only why anything after $metadata is ignored in links of format https://<Server>:<WebServicePort>/<ServerInstance>/OData/$metadata#..., but also why it only supports XML, and not Json (unlike actual Odata services).

Since the specific metadata you want is identified by a fragment appended to the metadata URI, you must fetch the entire $metadata document and then dereference the fragment on the client.

The good news is that the fragment dereferencing is pretty straightforward. A fragment like #customer specifies an EntityType element whose Name attribute has the value customer. Similarly, #customer/@someprop maps to a Property element whose Name attribute is someprop.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!