I'm using exist-db over docker container. Installing Java over Ubuntu and install the eXist installation headless jar, also adding data Volume (Azure file), that store all the physically files and the db data file.
I need to upload automatically files to the exist-db, after I generate new file and saving it to the volume drive, (using C#).
According to eXist documentation there are several methods to upload , but non of them works for me.
- Dashboard or eXide - not relevant - it supposed to be GUI applications.
- Java Admin Client - not working because have no GUI -> I'm getting this failure: 'No X11 DISPLAY variable was set, but this program performed an operation which requires it...'
- Over REST or WebDAV via web client (using browser or by code), I can run xQuery for queries, but for storing new file? how?
So, the solution I found is to write xQuery file, using xmldb:store function.
Set the new file name and location(in the volume) and run it by WebDAV or REST.
But I feel that there is a simpler solution...
Anyone can help?
BTW, this it the xmldb:store Xquery file:
xquery version "3.1";
declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
import module namespace xmldb="http://exist-db.org/xquery/xmldb";
declare function local:upload() {
let $filename := request:get-uploaded-file-name('file')
let $log-in := xmldb:login("/db", "Admin", "admin")
let $file := 'file:////usr/new_file_location.xml'
let $record := doc($file)
let $store := xmldb:store("/db/akn", "new_file_name.xml", $record )
return
<results>
<message>File {$file} has been stored.</message>
</results>
};
local:upload()