Macro Webservice Libre Office - 多次调用



我正在从 Libre Office 宏调用 Web 服务。我使用它将数据从 Calc 传递到 Web 服务器,但宏调用 Web 服务 5 次,即使该命令只调用一次:

svc = createUnoService("com.sun.star.sheet.FunctionAccess")
dim ss as string
ss = getWSAdress() + "webservices/" + t
sendWS=svc.callFunction("WEBSERVICE",Array(ss))

是否可以避免 Web 服务被调用 5 次?

刚刚测试过。 WEBSERVICE 在每次调用时发出以下 HTTP 1.1 请求:

PROPFIND /test HTTP/1.1
Keep-Alive: 
Connection: TE, Keep-Alive
TE: trailers
Host: 192.168.0.10:2000
Depth: 0
Content-Length: 237
Content-Type: application/xml
Pragma: no-cache
User-Agent: LibreOffice
Post-Data:
<?xml version="1.0" encoding="utf-8"?>
<propfind xmlns="DAV:"><prop>
<resourcetype xmlns="DAV:"/>
<IsReadOnly xmlns="http://ucb.openoffice.org/dav/props/"/>
<getcontenttype xmlns="DAV:"/>
<supportedlock xmlns="DAV:"/>
</prop></propfind>
PROPFIND /test HTTP/1.1
Connection: TE
TE: trailers
Host: 192.168.0.10:2000
Depth: 0
Content-Length: 237
Content-Type: application/xml
Pragma: no-cache
User-Agent: LibreOffice
Post-Data:
<?xml version="1.0" encoding="utf-8"?>
<propfind xmlns="DAV:"><prop>
<resourcetype xmlns="DAV:"/>
<IsReadOnly xmlns="http://ucb.openoffice.org/dav/props/"/>
<getcontenttype xmlns="DAV:"/>
<supportedlock xmlns="DAV:"/>
</prop></propfind>
PROPFIND /test HTTP/1.1
Connection: TE
TE: trailers
Host: 192.168.0.10:2000
Depth: 0
Content-Length: 237
Content-Type: application/xml
Pragma: no-cache
User-Agent: LibreOffice
Post-Data:
<?xml version="1.0" encoding="utf-8"?>
<propfind xmlns="DAV:"><prop>
<resourcetype xmlns="DAV:"/>
<IsReadOnly xmlns="http://ucb.openoffice.org/dav/props/"/>
<getcontenttype xmlns="DAV:"/>
<supportedlock xmlns="DAV:"/>
</prop></propfind>
HEAD /test HTTP/1.1
Connection: TE
TE: trailers
Host: 192.168.0.10:2000
Pragma: no-cache
User-Agent: LibreOffice
GET /test HTTP/1.1
Connection: TE
TE: trailers
Host: 192.168.0.10:2000
Accept-Encoding: gzip
Pragma: no-cache
User-Agent: LibreOffice

所以你是对的。每个调用有 5 个请求。PROPFIND 请求来自 HTTP WebDAV 扩展。

因此,您的 Web 服务必须支持 WebDAV,或者它必须只对 GET 请求做出反应。

最新更新