Retrieving documents from WebDocs

In order to query and retrieve WebDocs iSeries documents from a Windows based application, the following steps must be done.

Step 1: Make query

A document query must be made on the DOCS00 file in library RJSIMAGE to retreive a list of documents along with the document ID. 
 
SQL query filters can be done against fields TITLE, KEYWORD1-KEYWORD10 or any of the other fields in the table when you are querying the database. 
 
Ultimately the field needed to retrieve the actual image is the document ID from the DOCID field. 
 
The list may be presented to the user via HTML. 

Step 2: Get most recent version

After the document ID (DOCID) has been retreived, the DOCVER00 table must be queried to determine the most recent version of the document. 
 
The following sample SQL statement can be used to get the most recent version record:
 
SELECT * FROM DOCVER00 A WHERE VDOCID = 'DOCID' AND VREVISION = (SELECT MAX(REVISION) FROM DOCVER00 B WHERE B.VDOCID = A.VDOCID) ORDER BY VDOCID, VREVISION
 
After the version record has been read, the iSeries IFS file location and path can be determined by looking at the VDOCFILE field or VFTPFILE if the document has been moved to secondary storage.  Most like the VDOCFILE field will suffice. 
 
Then the IFS file or document ID can be passed off to a file retrieval mechanism. 

Step 3: Retrieve Copy

After the IFS file name has been determined, a copy of the file needs to be retrieved from the iSeries by one of the following methods:
Using WebDocs iSeries URL document retrieval

Programatically create Webdocs session via login URL:
http://1.1.1.1:1080/imageserver/doc100r?action=LOGIN3&INWEBU=TEST&INWEBP...
Pass it via an HTTP call from your Windows based programming language or tool of choice.
Scrape Session ID
Then scrape the Session ID from the resulting HTML value
SESSID:TEST07180611444350RJSIMAGE219135
Pass new URL
Pass the following URL along with the document ID to the view URL and the document file will be returned:

http://1.1.1.1:1080/IMAGESERVER/DOC100R?ACTION=VIEW&IDOCID=AS400DOC-0000...

Serve File

File can then be served via PC web application.
UNC share exposed via NetServer on the iSeries
\\ISERIES\RJSIMAGEDOC\AS400DOC-0000000000001.PDF
FTP
FTP can be used to download the IFS file to the Windows PC if you have a Windows FTP component that can transfer files via FTP. 
Apache web site
An Apache Web Site that can expose the RJS imaging document directories so a variation of the URM document retreival may be used. WebDav can also be set up on the Apache Web Site and you can use a WebDav component to retreive any files. 
WebDocs iSeries .Net API
This API uses a .Net converted version of the JT400 classes, so startup times may or may not be sufficient for a high-speed web site unless objects are cached in the IIS server sessions via session variables.   
WebDocs iSeries Web Service & COM wrapper
The WebDocs iSeries Web Service and COM wrapper can be used to retreive documents from the iSeries. 
 
Note: This is currently in beta test mode and requires the web service to run on an Apache Tomcat Server and COM API to be registered on a Windows Server. 
Etc
Any other method of transferring files from the iSeries may also be used. 
 

Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: December 10, 2016