gpt4 book ai didi

excel - Olingo 和 Excel

转载 作者:行者123 更新时间:2023-12-04 21:34:09 27 4
gpt4 key购买 nike

我已经下载了Olingo server sample (Odata4),编译并部署在我本地的tomcat上

浏览网址http://localhost:8080/odata-server-sample/cars.svc/我明白了

<?xml version="1.0" encoding="UTF-8"?>
<app:service xmlns:app="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:metadata="http://docs.oasis-open.org/odata/ns/metadata" metadata:context="$metadata">
<app:workspace>
<atom:title>olingo.odata.sample.Container</atom:title>
<app:collection href="Cars" metadata:name="Cars">
<atom:title>Cars</atom:title>
</app:collection>
<app:collection href="Manufacturers" metadata:name="Manufacturers">
<atom:title>Manufacturers</atom:title>
</app:collection>
</app:workspace>
</app:service>

我不知道 OData 协议(protocol),但它似乎是合法的......

现在,如果我使用 PowerQuery 将其提供给 Excel 2016:
数据 > 新查询 > 来自其他来源 > 来自 OData 源

我收到错误 Invalid URI: The hostname could not be parsed.
如果我改用这个 vba 代码:
Option Explicit

' References that need to be added:
' Microsoft XML, v6.0
' Microsoft Scripting Runtime

Const ODataErrorFirst As Long = 100
Const ODataCannotReadUrlError As Long = ODataErrorFirst + 1
Const ODataParseError As Long = ODataErrorFirst + 2

Sub test()
ODataReadUrl ("http://localhost:8080/odata-server-sample/cars.svc/")
End Sub

' Given a URL, reads an OData feed or entry into an XML document.
Function ODataReadUrl(ByVal strUrl As String) As MSXML2.DOMDocument60
Dim objXmlHttp As MSXML2.XMLHTTP60
Dim objResult As MSXML2.DOMDocument60
Dim strText As String

' Make a request for the URL.
Set objXmlHttp = New MSXML2.XMLHTTP60
objXmlHttp.Open "GET", strUrl, False
objXmlHttp.send

If objXmlHttp.Status <> 200 Then
Err.Raise ODataCannotReadUrlError, "ODataReadUrl", "Unable to get '" & strUrl & "' – status code: " & objXmlHttp.Status
End If

' Get the result as text.
strText = objXmlHttp.responseText
Set objXmlHttp = Nothing

' Create a document from the text.
Set objResult = New MSXML2.DOMDocument60
objResult.LoadXML strText
If objResult.parseError.ErrorCode <> 0 Then
Err.Raise ODataParseError, "ODataReadUrl", "Unable to load '" & strUrl & "' – " & objResult.parseError.reason
End If

Set ODataReadUrl = objResult
End Function

我得到 Not valid at root level. (在我的意大利语 Excel 中: Non valido al primo livello del documento.)

这是什么意思?
Olingo 与 excel 不兼容?

最佳答案

关于excel - Olingo 和 Excel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43138210/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com