OData:发现不兼容的类型种类.发现类型为“原始"而不是预期类型为“无" [英] OData: Incompatible type kinds were found. Found type kind 'Primitive' instead of the expected kind 'None'

查看:97
本文介绍了OData:发现不兼容的类型种类.发现类型为“原始"而不是预期类型为“无"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Excel 16.0.11929.20436从其他来源获取数据:OData Feed.输入网址时,出现以下错误. OData:发现不兼容的类型种类.发现类型为原始",而不是预期的类型为无".

I am trying to use Excel 16.0.11929.20436 Get Data from Other Sources : OData Feed. When I enter the url I get the below error. OData: Incompatible type kinds were found. Found type kind 'Primitive' instead of the expected kind 'None'.

我在github中提到了这个问题 https://github.com/OData/odata.net/issues/1445 ,它提到"OData协议不允许同一名称空间中顶级元素的重复名称" 基于该解决方案,我修复了CSDL中的重复项,但是即使没有重复项也仍然遇到相同的问题.下面是修复后生成的CSDL.当我在浏览器中键入URL时,数据加载没有任何错误.仅当在MS Excel中使用时,它才会给出错误.因此,我非常确定这必须具有某些Excel OData功能,但是不幸的是,没有日志可以检查问题所在.不幸的是,Microsoft客户支持团队对此问题没有积极的回应.

I referred to the issue in github https://github.com/OData/odata.net/issues/1445 and it mentioned 'OData protocol does not allow duplicate names for top-level elements in the same namespace' Based on that solution, I fixed the duplicates in my CSDL but still get the same issue even without the duplicates. Below is the generated CSDL after the fix. When I type the url in the browser, data is loaded without any errors. Only when used in MS Excel it gives the error. Therefore I am pretty sure this has to be with some Excel OData functionality, but unfortunately there is no log that I can check what the issue is. Unfortunately Microsoft client support team has no positive response to give with regard this problem.

但是,CustomerInfo具有一个名为'CustomerCategory'的子元素,该子元素引用了CustomerCategory.但这不是顶层元素.

However CustomerInfo has a sub element that has name 'CustomerCategory' which referred to the CustomerCategory. But that is not a top level element.

  1. 现在仍然可能会出现同样的错误的原因是什么?如何对此进行验证?验证站点 http://validator.odata.org/也已关闭.
  2. 是否可以检查excel日志或调试过程?
  1. What could be the reason now to still get this same error? How can this be validated? the validation site http://validator.odata.org/ is also down.
  2. Is there a way to check the excel logs or debug the process?

推荐答案

我想出了解决此问题的方法.发布此答案的目的是帮助遇到麻烦的人.

I figured out the solution for this issue. Posting this answer with the intention of helping some one who is having trouble.

如果您的服务器也位于同一台计算机上,则安装fiddler时,它将不会侦听来自本地主机的请求.因此,请执行以下配置将其修复.

When you install fiddler it will not listen to requests from local host if your server is also in the same machine. Therefore do the following configurations to get it fixed.

  1. 提琴手->规则->自定义规则
  2. 在方法代码中添加以下代码: OnBeforeRequest(oSession:Session)

if(oSession.HostnameIs("machine_name")){oSession.host ="127.0.0.1:8080"; }

if (oSession.HostnameIs("machine_name")) { oSession.host = "127.0.0.1:8080"; }

将端口更改为您具有本地主机服务器的任何其他端口的端口

change the port to the port you have any other port for localhost server

现在,提琴手将监听您对本地服务器的请求.

Now your requests to the local server will be listened by fiddler.

如果您通过浏览器发送请求,则默认情况下将监听这些请求. 如果您使用Microsoft Excel OData提要URL发送请求:则必须在主机名的末尾附加" .fiddler ".

If you send the requests via browsers, then those will be listened by default. If you use Microsoft Excel OData feed url to send the request : then you have to append '.fiddler' to the end of hostname.

示例:

i. http://localhost.fiddler:8080/contxt_root/ProjectionName.svc/EntitySetName?$format=json 
ii. https://your_hose.fiddler:port/context_root/ProjectionName.svc/EntitySetName?$format=json

希望这对使用fiddler调试Microsoft OData提要URL的人有所帮助.

Hope this helps with anyone struggling with debugging Microsoft OData feed urls with fiddler.

这篇关于OData:发现不兼容的类型种类.发现类型为“原始"而不是预期类型为“无"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆