In this article I will describe a way of exporting documents out of GX webmanager. There is no one-size-fits-all method for doing this, so instead I will describe the steps to get you off the ground.

Logging in using Xill IDE

Below function can be used for loggin in to GX webmanager, after doing so successfully, Xill IDE will have a session that allows you to export everything you need.

function login(baseurl, username, password){
    var url = baseurl :: "/web/webmanager/id%3d26101/mode%3dedit/fromlogin%3dtrue"; // the url of the login page may vary, depending on the GX installation
    var page = Web.loadPage(url);
    
    // select the fields used for your username, password, and the login button. 
    var fieldUsername = Web.xPath(page,".//input[@name='user']");
    var fieldPassword = Web.xPath(page,".//input[@name='password']");
    var buttonLogin = Web.xPath(page,".//input[@value='Login']");

    // next input your username, password, and click login
    Web.input(fieldUsername, username);
    Web.input(fieldPassword, password);
    return(Web.click(buttonLogin));
} 

If above fields give you a NULL value, check the frontend and use 'inspect element' to figure out the exact fields being used in your case.

Getting the document overview XML

In the next step we will be using a webservice to extract a complete list of all the documents nicely formatted in XML. To achieve this you have to intercept your browser network traffic.

While on the search screen in chrome, rightclick anywhere, choose 'inspect (element)' or press CTRL+SHIFT+I. Next, go to the 'Network' tab, check the option to 'Preserve log', and click the search button in GX (see below picture). 

GX Webmanager document overview

Now look back at the network tab. One of the requests will look similar to this:

http://localhost/web/wcbservlet/com.gxwebmanager.gxpublic.servlet/searchdocument?alt=xml&webid=26098&query=1234&datefrom=&dateto=&documenttypeid=1234noresults=10&startindex=0

Notice the 'alt=xml' in the url, which specifies that the answer will be in XML format, this is what you want. Also notice the 'noresults=10' (10 can be any number), copy this url and change the value of noresults to a very high number, so that all the documents will be grabbed. Next, in Xill IDE, do:

Web.download(url, path);

The XML will look like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<result>
    <entry xsi:type="DocumentSearchResult" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <characteristic></characteristic>
        <documentUses>
            <documentType>A</documentType>            
            <startDate>2014-09-19T00:00:00+02:00</startDate>
            <stringId>AAB5E3CA-7DCD-40D3-B371-9B81D7B3BADC</stringId>
        </documentUses>
        <publicationdate>2014-09-23T11:13:00+02:00</publicationdate>
        <state>PUBLISHED</state>
        <stringId>D8ED9388-1F2C-464A-A236-395A9150E01E</stringId>
        <title>title1</title>
    </entry>    
    <entry xsi:type="DocumentSearchResult" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <documentUses>
            <documentType>B</documentType>            
            <startDate>2004-01-07T00:00:00+01:00</startDate>
            <stringId>548F7B85-B1C3-464B-BB30-6F143B1960D9</stringId>
        </documentUses>
        <publicationdate>2004-01-07T00:00:00+01:00</publicationdate>
        <state>PUBLISHED</state>
        <stringId>CD8BCF4A-D5E7-4951-994A-C0B9D5CCF034</stringId>
        <title>title 2</title>
    </entry>
    ...

Getting individual document metadata

Follow the exact same steps as you did before to get the document overview XML, only this time click on one of the search results. In the Network tab, one or more url GET requests are used to grab all the metadata, the total amount depending on the GX installation.

Next, create a list of those URLS, and notice the returning ID in all of them, this is the ID of the document, and this value can be manipulated to get the metadata of all the other documents! Use the previously obtained document overview XML as input for this: 

function getDocumentMetadata(overview){
    var documents = Web.xPath(overview, ".//entry/stringId/text()"); // this will store all document id's in documents
    foreach(id in documents){
        // here, do a download as we did before on all the urls, but use the variable id on the id spot in the url, like in this example:
        Web.download("http://localhost/web/wcbservlet/com.gxwebmanager.gxpublic.servlet/documentuse?alt=xml&documentid=":: id ::"&_=1431345559713", exportPath :: id);
    }
} 

 The result will be a local bunch of XML files containing your document metadata!

Downloading binaries

Now that you have all the metadata, it is possible to download all the binaries. For that, you have to look for a field in the metadata XML named fileid. When you found the id, you can loop through all of them, and construct the following URL:

var binaryUrl = "http://localhost/web/wcbservlet/com.gxwebmanager.gxpublic.fileservlet?fileid= " :: fileid

Note that this URL may vary per GX installation, but it's relatively easy to figure out by downloading a binary through the frontend of the application. Mouse over the link and it will show.