BaseX WebDAV Rejecting Large Files

Monday, 3 December 2018 · 4 messages · last reply 4 Dec 2018
KD
Kanda (US), David3 Dec 2018 20:24 #
Hello, We are attempting to use WebDAV to pump a large zip file to BaseX then have BaseX unzip and import the uncompressed xml file. WebDAV transfer works well with small files, (less than 1Mb) but it fails immediately when uploading a large zip or xml file (~50MB). Is there any sample code to demonstrate programmatically transferring a large file to BaseX over WebDAV? Cheers, David
CG
Christian Grün4 Dec 2018 08:48 #
Dear David, I’ve just added a 200 MB file to a database via WebDAV without problems. Which WebDAV client are you using? Best, Christian
Quoted text · David · 13 lines
On Mon, Dec 3, 2018 at 8:24 PM Kanda (US), David <david.kanda at boeing.com> wrote: > > Hello, > > > > We are attempting to use WebDAV to pump a large zip file to BaseX then have BaseX unzip and import the uncompressed xml file. WebDAV transfer works well with small files, (less than 1Mb) but it fails immediately when uploading a large zip or xml file (~50MB). Is there any sample code to demonstrate programmatically transferring a large file to BaseX over WebDAV? > > > > Cheers, > > David
KD
Kanda (US), David4 Dec 2018 17:54 #
Christian, I was trying to upload via Java code using the httpclient library. I am using the code below.
public void insertFile(File content) throws Exception {
        final HttpClientContext context =  buildUserContext("http://localhost:8080/BaseX91/webdav/testDb/test", "admin", "admin");
        PutMethod httpMethod = new PutMethod("http://localhost:8080/BaseX91/webdav/testDb/test");
        InputStream is = new FileInputStream(content);
org.apache.commons.httpclient.HttpClient client = new org.apache.commons.httpclient.HttpClient();
        client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("admin", "admin"));
        RequestEntity requestEntity = new InputStreamRequestEntity(is);
        httpMethod.setRequestEntity(requestEntity);
        try {
            int statusCode = client.executeMethod(httpMethod);
            if (statusCode != HttpStatus.SC_OK) System.err.println("Method failed: " + httpMethod.getStatusLine());
            byte[] responseBody = httpMethod.getResponseBody();
            System.out.println(new String(responseBody));
        } catch (HttpException e) {
            System.err.println("Fatal protocol violation: " + e.getMessage());
            e.printStackTrace();
        } catch (IOException e) {
            System.err.println("Fatal transport error: " + e.getMessage());
            e.printStackTrace();
        } finally {
            httpMethod.releaseConnection();
        }
}
Quoted text · Christian Grün · 23 lines
-----Original Message----- From: Christian Grün [mailto:christian.gruen at gmail.com] Sent: Monday, December 03, 2018 11:49 PM To: Kanda (US), David <david.kanda at boeing.com> Cc: BaseX <basex-talk at mailman.uni-konstanz.de> Subject: Re: [basex-talk] BaseX WebDAV Rejecting Large Files Dear David, I’ve just added a 200 MB file to a database via WebDAV without problems. Which WebDAV client are you using? Best, Christian On Mon, Dec 3, 2018 at 8:24 PM Kanda (US), David <david.kanda at boeing.com> wrote: > > Hello, > > > > We are attempting to use WebDAV to pump a large zip file to BaseX then have BaseX unzip and import the uncompressed xml file. WebDAV transfer works well with small files, (less than 1Mb) but it fails immediately when uploading a large zip or xml file (~50MB). Is there any sample code to demonstrate programmatically transferring a large file to BaseX over WebDAV? > > > > Cheers, > > David
CG
Christian Grün4 Dec 2018 18:11 #
If you have some spare time, we would appreciate self-contained examples. Thanks in advance, Christian
Quoted text · David · 61 lines
On Tue, Dec 4, 2018 at 5:54 PM Kanda (US), David <david.kanda at boeing.com> wrote: > > Christian, > > I was trying to upload via Java code using the httpclient library. I am using the code below. > > public void insertFile(File content) throws Exception { > final HttpClientContext context = buildUserContext("http://localhost:8080/BaseX91/webdav/testDb/test", "admin", "admin"); > PutMethod httpMethod = new PutMethod("http://localhost:8080/BaseX91/webdav/testDb/test"); > InputStream is = new FileInputStream(content); > > org.apache.commons.httpclient.HttpClient client = new org.apache.commons.httpclient.HttpClient(); > > client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("admin", "admin")); > RequestEntity requestEntity = new InputStreamRequestEntity(is); > httpMethod.setRequestEntity(requestEntity); > try { > int statusCode = client.executeMethod(httpMethod); > if (statusCode != HttpStatus.SC_OK) System.err.println("Method failed: " + httpMethod.getStatusLine()); > byte[] responseBody = httpMethod.getResponseBody(); > System.out.println(new String(responseBody)); > } catch (HttpException e) { > System.err.println("Fatal protocol violation: " + e.getMessage()); > e.printStackTrace(); > } catch (IOException e) { > System.err.println("Fatal transport error: " + e.getMessage()); > e.printStackTrace(); > } finally { > httpMethod.releaseConnection(); > } > > } > > -----Original Message----- > From: Christian Grün [mailto:christian.gruen at gmail.com] > Sent: Monday, December 03, 2018 11:49 PM > To: Kanda (US), David <david.kanda at boeing.com> > Cc: BaseX <basex-talk at mailman.uni-konstanz.de> > Subject: Re: [basex-talk] BaseX WebDAV Rejecting Large Files > > Dear David, > > I’ve just added a 200 MB file to a database via WebDAV without problems. Which WebDAV client are you using? > > Best, > Christian > > > On Mon, Dec 3, 2018 at 8:24 PM Kanda (US), David <david.kanda at boeing.com> wrote: > > > > Hello, > > > > > > > > We are attempting to use WebDAV to pump a large zip file to BaseX then have BaseX unzip and import the uncompressed xml file. WebDAV transfer works well with small files, (less than 1Mb) but it fails immediately when uploading a large zip or xml file (~50MB). Is there any sample code to demonstrate programmatically transferring a large file to BaseX over WebDAV? > > > > > > > > Cheers, > > > > David

⚡Generated with XQuery