0

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

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

我可以避免 Web 服务被调用 5 次吗?

4

1 回答 1

0

刚测试过。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 请求作出反应。

于 2017-02-06T20:44:04.943 回答