Search code examples
libreoffice-calclibreoffice-basic

Macro Webservice Libre Office - called multiple times


I am calling a webservice from a Libre Office macro. I use it to pass data from Calc to a webserver, but the macro calls the webservice 5 times, even though, the command is only called once:

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

Can I avoid the webservice being called 5 times?


Solution

  • Just tested. WEBSERVICE makes the following HTTP 1.1 requests on each call:

    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
    

    So you are right. There are 5 requests each call. The PROPFIND requests comes from HTTP WebDAV extension.

    So either your web service must support WebDAV or it must only react on the GET request.