Macro Webservice Libre Office - 多次调用
Macro Webservice Libre Office - called multiple times
我正在从 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 次吗?
刚刚测试。 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 扩展。
因此,要么您的网络服务必须支持 WebDAV,要么必须仅对 GET 请求作出反应。
我正在从 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 次吗?
刚刚测试。 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 扩展。
因此,要么您的网络服务必须支持 WebDAV,要么必须仅对 GET 请求作出反应。