简体   繁体   English

从外部源 odata 提要提取的 Excel 数据不起作用

[英]Excel data pull from External Source odata feed does not work

We have got a ODATA feed web API, which is a data source for our Excel report.我们有一个 ODATA 提要 Web API,它是我们 Excel 报告的数据源。 This Odata feed, we are able to pull successfully, when it is hosted local & physical server.这个 Odata 提要,当它托管在本地和物理服务器上时,我们能够成功拉取。 When the same odata feed web API is hosted in cloud environment we are facing connection timeout issue.当相同的 odata feed web API 托管在云环境中时,我们面临连接超时问题。

Unable to Connect无法连接
We encountered an error when trying to connect我们在尝试连接时遇到错误
Details: "OData: Request failed: Unable to connect to the remote server"详细信息:“OData:请求失败:无法连接到远程服务器”

The same odata feed in cloud is accessible when we use office data connection(odc) in the excel file.当我们在 excel 文件中使用 office data connection(odc) 时,可以访问云中相同的 odata feed。

<html xmlns:o="urn:schemas-microsoft-com:office:office"
                            xmlns="http://www.w3.org/TR/REC-html40">

                            <head>
                            <meta http-equiv=Content-Type content="text/x-ms-odc; charset=utf-8">
                            <meta name=ProgId content=ODC.TableCollection>
                            <meta name=SourceType content=DATAFEED>
                            <title>OurApplication</title>
                            <xml id=docprops><o:DocumentProperties
                              xmlns:o="urn:schemas-microsoft-com:office:office"
                              xmlns="http://www.w3.org/TR/REC-html40">
                              <o:Name>OurApplication</o:Name>
                             </o:DocumentProperties>
                            </xml><xml id=msodc><odc:OfficeDataConnection
                              xmlns:odc="urn:schemas-microsoft-com:office:odc"
                              xmlns="http://www.w3.org/TR/REC-html40">
                              <odc:Connection odc:Type="DATAFEED">
                               <odc:ConnectionString>
Data Source=&quot;https://OurApplication.com/odata/OurTable&quot;
</odc:ConnectionString>
                               <odc:CommandType>TableCollection</odc:CommandType>
                               <odc:CommandText>&quot;OurTable&quot;</odc:CommandText>
                              </odc:Connection>
                             </odc:OfficeDataConnection>
                            </xml>
                            <style>
                            </style> 
                            </head> 
                            </html>  

But, it is not accessible when we try to do bring using Get External Data as given below:但是,当我们尝试使用 Get External Data 进行引入时,它是不可访问的,如下所示:

在 Excel 中获取外部数据

We are getting below error in fiddler.我们在 fiddler 中遇到错误。

[Fiddler] The connection to 'OurApplication.com' failed. [Fiddler] 与“OurApplication.com”的连接失败。
Error: TimedOut (0x274c).错误:超时 (0x274c)。
System.Net.Sockets.SocketException A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond OurApplicationIPAddress:OurApplicationPortNumber System.Net.Sockets.SocketException 连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接的主机未能响应 OurApplicationIPAddress:OurApplicationPortNumber 而建立连接失败

When I try to use M language for OData source, I am getting error like below:当我尝试将 M 语言用于 OData 源时,出现如下错误:

= OData.Feed ("OurApplication/odata/OurTable"
    ,null, [Timeout = #duration(0,2,0,0)])

DataSource.Error: OData: Request failed: The remote server returned an error: (502) Bad Gateway. DataSource.Error:OData:请求失败:远程服务器返回错误:(502) 错误网关。 (Fiddler - Connection Failed) Details: DataSourceKind=OData DataSourcePath= http://Ourapplication:portnumber/odata/ $metadata Url= http://courapplication/odata/ $metadata (Fiddler - 连接失败)详细信息:DataSourceKind=OData DataSourcePath= http://Ourapplication:portnumber/odata/ $metadata Url= http://courapplication/odata/ $metadata

Please help us in resolving how to connect to ODATA feed in Powerquery in excel.请帮助我们解决如何在 Excel 中的 Powerquery 中连接到 ODATA 提要。

尝试指定超时参数(例如 2 小时):

= OData.Feed("http://link", null, [Timeout = #duration(0,2,0,0)])

In our case, basic authentication was not working for the PaaS (we were using cloud foundary based PaaS hosting) hosted webAPI.在我们的案例中,基本身份验证不适用于 PaaS(我们使用基于云代工厂的 PaaS 托管)托管的 webAPI。 We created one more endpoint with anonymous authentication and used that endpoint in our excel connection to get data using OData .我们创建了另一个具有匿名身份验证的端点,并在我们的 excel 连接中使用该端点来使用OData获取数据。

Note: In our case, as the data was not sensitive and moreover, being internal application, we went ahead with anonymous authentication.注意:在我们的例子中,由于数据不敏感,而且是内部应用程序,我们继续进行匿名身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM