About WebDocs iSeries API Interfaces

You may need to integrate WebDocs iSeries with your own applications to streamline document check-in, searching, and retrieval. This articles provides information about the API interface capabilities for WebDocs iSeries.

If you need to discuss requirements for specific coding situations, contact RJS Software for FREE integration sample code.
 
RJS Software also provides consulting services for more complex programming requirements. RJS Software has experience with almost all iSeries and PC languages including: VB, VBScript, Javascript, ASP, JSP, Java, RPG, COBOL, and more.
 

WebDocs iSeries Database Tables in the RJSIMAGE Library

  • DOCS00 - The main information for documents' search keys and the IFS location of each document file. 
  • DOCVER00 - The version information and tracking of document revisions. There is always at least one version record for every document. 
  • DOCFLR00 - The document folder list.
  • DOCSEC00 - The users' folder security.
  • DOCUSR00 - The user table.
  • DOCTYPE00 - The Document Type descriptions.
  • DOCKEY00 - The keyword descriptions for each Document Type that display in the WebDocs iSeries interface. 

Standard Document Search Fields

  • DOCID - The document ID.
  • TITLE - The document title.
  • DOCTYPE - The document file type. For example: TIF, PDF, DOC, and so on.
  • DOCTYPE2 - The Document Type. For example: AR, AP, Orders, and so on.
  • CHKDATE - The document creation date.
  • FOLDER1 - FOLDER3 - The document folder, for levels 1-3 respectively.
  • KEYWORD1 - KEYWORD10 - The document's search keys 1 - 10.
For example:
  • To allow a customer to only see their own orders and invoices, based on their customer number 123456 for search key 1, use:

    (KEYWORD1 = '123456')

  • To allow a customer to only see their own orders and invoices, based on their customer number 123456 for search key 1 and the Document Types ORDERS and INVOICES, use:

    ((KEYWORD1 = '123456'  and DOCTYPE2 = 'ORDERS') and (KEYWORD1 = '123456'  and DOCTYPE2 = 'INVOICES'))

  • To allow a customer to only see their own orders and invoices based on their customer number 123456 for search key 1, the Document Types ORDERS and INVOICES, and the folder name CUSTOMERS, use:

    ((KEYWORD1 = '123456'  and DOCTYPE2 = 'ORDERS') and (KEYWORD1 = '123456'  and DOCTYPE2 = 'INVOICES')) and (FOLDER1='CUSTOMERS')

iSeries Report Search Fields

  • DCSPOOL - The spool file name.
  • DCDATE - The spool file date.
  • DCUSRDTA - The spool user data.
  • DCUSRDFN - The user defined data.
  • DCUSERID - The spool file user ID.
  • DCFORM - The spool file form type.
  • DCJOB - The spool file job name.
  • DCOUTQ - The output queue.
  • DCOLIB - The spool file user defined data.

Searching for documents by Web URL

The easiest way to integrate with WebDocs iSeries to use the URL search interface built into the WebDocs executable on the iSeries. Then, you can use any application that can call a web URL to perform document searches.
 
For example:
  • Any web applications that can create a web link.
  • Any ASP, JSP/Servlet PHP, Python, or even .NET web applications.
  • VB or VB.NET applications that can use the ShellExecute function to execute a command line. 
To search for documents by web URL, build a URL with the relevent search criteria and then call or click the URL link.
 

Formatting Search URL Strings

Begin the search string with the following, where 1.1.1.1 is your iSeries web server's IP address:
 
http://1.1.1.1/imageserver/doc100r?action=Search
 
Add a unique session login ID to the end of the URL. For more information, see the CL samples in the file SOURCE in the RJSIMAGE library.
 
&ISESSION=
 
Add any additional search keywords to the end of the URL. You can combine as many search keywords as you need to by separating search keywords with an ampersand (&):
 
&srchtitle=Invoice
 
For example:
 
  • To search for all documents with the title Invoice, use:

    http://1.1.1.1/imageserver/doc100r?action=Search&ISESSION=<session ID>&srchtitle=Invoice

  • To search for all documents with the title User Guide and search key 1, part number, 123456, use:

    http://1.1.1.1/imageserver/doc100r?action=Search&ISESSION=<session ID>&srchtitle=User Guide&srchfld01=123456

iSeries Office Integrator Sample CL for Searching for Documents by Web URL from within an iSeries Application

If you use iSeries Office Integrator to integrate document scanning and retrieval with an existing 5250 application, you can assign a function key in any RPG or COBOL application to call either of these functions. Then, users only need to press the function key to quickly locate documents that match selected criteria, allowing for single-click document searches from business applications.
 
The following CL sample is a document search:
 
PGM    PARM(&SEARCHVAL)

DCL        VAR(&SEARCHVAL) TYPE(*CHAR) LEN(100) +
                    VALUE('123456') /* Sample KEYWORD 1 value +
                    of 123456 */
DCL        VAR(&NEWSESSION) TYPE(*CHAR) LEN(255)
DCL        VAR(&MAINURL) TYPE(*CHAR) LEN(200)
DCL        VAR(&URL) TYPE(*CHAR) LEN(255)

MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ERRORS))

/***********************************************************/
/* Retrieve MAIN Image Server/400 URL Setting.             */
/* Example: http://192.168.1.1                             */
/***********************************************************/
RTVDTAARA  DTAARA(MAINURL) RTNVAR(&MAINURL)

/***********************************************************/
/* Create Image Server Web Session ID. This logs the green */
/* screen user into the Image Server/400 software.         */
/*                                                         */
/* *AS400USER can be used for the WEBUSER parm if desired  */
/* and you have set up Image Server user IDs which match   */
/* the corresponding AS/400 user id.                       */
/*                                                         */
/* *NOPASSWORD can be used for WEBPASS is you want to      */
/* ignore Image Server passwords when launching a new      */
/* web session from a green screen.                        */
/***********************************************************/
DOCSESRTV  WEBUSER(TEST) WEBPASS(*NOPASSWORD) +
         RTNSESSION(&NEWSESSION)

/***********************************************************/
/* Build URL to Launch Image Server/400 document search.   */
/* This example searches using KEYWORD1                    */
/* Search Keyword values:                                  */
/* SRCHFLD01 - SRCHFLD10 - Keyword Fields to search        */
/*                         Multiple keywords can be used.  */
/* SRCHTITLE - Search the document title                   */
/* SRCHDOCTYP- Search the specified document type          */
/* BEGDAT    - Set the beginning doc date 'MM/DD/YYYY'     */
/* ENDDAT    - Set the beginning doc date 'MM/DD/YYYY'     */
/***********************************************************/
CHGVAR     VAR(&URL) VALUE(&MAINURL |< +
         '/IMAGESERVER/DOC100R?ACTION=Search&ISESSIO +
         N=' |< &NEWSESSION |< '&SRCHFLD01=' |< +
         &SEARCHVAL)

/***********************************************************/
/* Use the iSeries Integrator to launch the web browser    */
/* search for Image Server/400.                            */
/***********************************************************/
RJSOFFICE/OFCRUNPC RMTSYS(*CURRENT) CMD(&URL) +
                 OPTION(*WEBSITE)

RETURN /* Normal exit */

/***********************************************************/
/* Handle errors */
/***********************************************************/
ERRORS:   SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Errors +
                   occurred while launching Image Server search URL')

ENDPGM

5250 Screen Scraping Access to Documents

You can use 5250 Integrator in conjunction with Client Access/400 to easily grab information from a 5250 application to scan, index, or search for a document. 5250 Integrator uses a VB scripting engine, so you can use a 5250 screen-scraping macro to call a ODBC data source to interact with another database and perform any logic that VBScript can. 
 

Web Facing and HATS

IBM has some new tools available for building web applications from existing 5250 applications. If you are using HATS or Web Facing, contact RJS Technical Support for help creating Java/JSP pages that can interface with WebDocs iSeries. JSP can quickly build URLs for locating documents using WebDocs URL searches. 
 

ODBC, ADO and OLEDB Driver Database Access

If you are writing custom-PC or web-based business applications that run in VB, ASP, ASNA Visual RPG, any .NET language, or any other language that can read and write data via an ODBC, ADO or OLEDB, you can integrate with WebDocs iSeries to retrieve or add WebDocs documents. You may want to limit access to retrieving documents so as not to bypass the WebDocs check-in processes. 
 
To integrate a VB application:
  1. Configure the Client Access/400 ODBC data source to talk to the iSeries database.
  2. Write VB or ASP code that uses the ODBC driver.
  3. Set up business applications to perform a SQL query against the DOCS00 table and read by folder or limit the document list by KEYWORD1 - KEYWORD10 selection criteria.

JDBC Driver Database Access

If you will be developing interactive or web applications in Java or any language that can read and write data via a JDBC driver, you can integrate with WebDocs iSeries to retrieve or add WebDocs documents. You may want to limit access to retrieving documents so as not to bypass the WebDocs check-in processes. You can use the Java Toolbox to integrate with WebDocs iSeries using Java. 
 
To integrate a Java application:
 
  1. Configure the Java Toolbox JDBC data source to talk to the iSeries database. 
  2. Write Java, JSP, or Servlet  code that uses the iSeries JDBC driver. 
  3. Set up business applications to perform a SQL query against the DOCS00 table and read by folder or limit the document list by KEYWORD1 - KEYWORD10 selection criteria.

Document Check-In Exit Points

You may want to scan incoming documents with search-key information such as the customer number, invoice number, PO number, and so on, and then have an exit program retrieve information from a business application after check-in. Exit points allow you to fill this data after check-in to decrease or eliminate manual index entry for new documents.
 
The DOCHKIN CL command checks in new documents and calls an exit-point program named DOCEXITC. The search keys, Document Type, IFS file name, and document ID are passed to the exit program so the user can update the index keys with information from the iSeries database. 
 
Note: DOCCHKIN can also call a pre-check-in program (DOCEXITPC) that can validate information in an iSeries database before check-in. If the validation fails, the pre-exit check-in program can send an ESCAPE message back to an iSeries program or a pop-up message back to Imaging Scan Workstation. 
 
RJS Software provides sample pre-check-in and post-check-in exit programs in the file SOURCE in the RJSIMAGE library. Below is a CL/RPG sample for updating keywords after check-in using the DOCEXITC program. 

DOCEXITC CL Exit-Point Program

This program calls the DOCEXITR RPG program that performs the keyword updates:
 
/***********************************************************************/
/*             AUTHOR:   RICHARD J. SCHOEN                             */
/*       DATE WRITTEN:   10/02/2002                                    */
/*            PURPOSE:   MAIN DOCUMENT CHECK-IN EXIT POINT             */
/*EXPECTED PARAMETERS:   NONE                                          */
/*      SWITCHES USED:   NONE                                          */
/*                LDA:   NONE                                          */
/***********************************************************************/
          

PGM        PARM(&DOCID &REVISION &DOCTITLE &DOCFLR1 +
         &DOCFLR2 &DOCFLR3 &KEY1 &KEY2 &KEY3 &KEY4 +
         &KEY5 &KEY6 &KEY7 &KEY8 &KEY9 &KEY10 +
         &DOCPATH &DOCFILE &DOCTYPE)
                  

DCL        VAR(&DOCID) TYPE(*CHAR) LEN(100)
DCL        VAR(&REVISION) TYPE(*DEC) LEN(9 0)
DCL        VAR(&DOCTITLE) TYPE(*CHAR) LEN(200)
DCL        VAR(&DOCFLR1) TYPE(*CHAR) LEN(100)
DCL        VAR(&DOCFLR2) TYPE(*CHAR) LEN(100)
DCL        VAR(&DOCFLR3) TYPE(*CHAR) LEN(100)
DCL        VAR(&KEY1) TYPE(*CHAR) LEN(200)
DCL        VAR(&KEY2) TYPE(*CHAR) LEN(200)
DCL        VAR(&KEY3) TYPE(*CHAR) LEN(200)
DCL        VAR(&KEY4) TYPE(*CHAR) LEN(200)
DCL        VAR(&KEY5) TYPE(*CHAR) LEN(200)
DCL        VAR(&KEY6) TYPE(*CHAR) LEN(200)
DCL        VAR(&KEY7) TYPE(*CHAR) LEN(200)
DCL        VAR(&KEY8) TYPE(*CHAR) LEN(200)
DCL        VAR(&KEY9) TYPE(*CHAR) LEN(200)
DCL        VAR(&KEY10) TYPE(*CHAR) LEN(200)
DCL        VAR(&DOCPATH) TYPE(*CHAR) LEN(255)
DCL        VAR(&DOCFILE) TYPE(*CHAR) LEN(255)
DCL        VAR(&DOCTYPE) TYPE(*CHAR) LEN(10)
DCL        VAR(&ERRRTN) TYPE(*CHAR) LEN(1)
                                                                                                          

MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ERRORS))

/***************************************************/
/* CALL EXIT RPG PROGRAM TO UPDATE                 */
/* DOCUMENT KEYWORDS. PASS THE DOCID & KEYWORD 1   */
/* SO WE KNOW WHICH DOC WE'RE UPDATING             */
/* THIS ALLOWS KEYWORDS TO BE AUTO-FILLED          */
/* AFTER DOCUMENT CHECK-IN.                        */
/***************************************************/
CALL       PGM(DOCEXITR) PARM(&DOCID &KEY1 &ERRRTN)

RETURN /* NORMAL EXIT */

/***************************************************/
/* HANDLE ERRORS */
/***************************************************/

ERRORS:
SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) +
         occurred while running Image Server +
         document check-in for document ID:' |> +
         &DOCID) MSGTYPE(*INFO)

MONMSG     MSGID(CPF0000) /* MAKE SURE WE EXIT */
SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) +
MSGDTA('ERRORWARN: Exit point Errors +
         occurred while running Image Server +
         document check-in for document ID:' |> +
         &DOCID) TOMSGQ(*SYSOPR)
MONMSG     MSGID(CPF0000) /* MAKE SURE WE EXIT */

ENDPGM   
 
The following is the DOCEXITR program that DOCEXITC calls:
 
H******************************************************************
H*                                                                *
H*  PROGRAM:    DOCEXITR                                          *
H*  PURPOSE:    Update Document Keywords based on values          *
H*              found in previous document with matching          *
H*              value in Key Field 1.                             *
H*  DATE:       04/23/2003                                        *
H*  AUTHOR:     RICHARD J. SCHOEN.                                *
H*                                                                *
H******************************************************************

F* Documents by DOCID
FDOCS01    UF   E           K DISK
F* Documents by KEYWORD1
FDOCS04    IF   E           K DISK
F                                     RENAME(DOCS00R:DOCS04R)
D*****
D* Timestamp data area
D*****         
D tstamp          s               z
D date            s               d   datfmt(*iso)
D time            s               t   timfmt(*iso)
D                 ds
D timeres                       12s 0
D   timetime                     6s 0 overlay(timeres:1)
D   timedate                     6s 0 overlay(timeres:7)

D WDOCTITLE       s            100A   inz('')
D WKEYWORD1       s            200A   inz('')
D WKEYWORD2       s            200A   inz('')
D WKEYWORD3       s            200A   inz('')
D WKEYWORD4       s            200A   inz('')
D WKEYWORD5       s            200A   inz('')
D WKEYWORD6       s            200A   inz('')
D WKEYWORD7       s            200A   inz('')
D WKEYWORD8       s            200A   inz('')
D WKEYWORD9       s            200A   inz('')
D WKEYWORD10      s            200A   inz('')

C****************************************************************
C* *ENTRY PARAMETER LIST
C****************************************************************
C     *ENTRY        PLIST
C                   PARM                    IDOCKEY         100
C                   PARM                    IKEYWORD1       200
C                   PARM                    ERRRTN            1

C****************************************************************
C* RETRIEVE DOCUMENT INFO FROM EXISTING DOCUMENT WITH MATCHING
C* VALUE IN KEY 1 AND UPDATE TO NEW DOCUMENT
C****************************************************************
C                   EVAL      ERRRTN = '0'

*                  ** Chain for document record with Keyword 1
*                  ** We need to see if old doc exists or not.
C     IKEYWORD1     SETLL     DOCS04
C     IKEYWORD1     READE     DOCS04                               33

*                  ** Bail out if our current DOCID is the only
*                  ** matching record. No need to update keywords.
C                   IF        %TRIM(DOCID) = %TRIM(IDOCKEY)
C                   EVAL      ERRRTN = '1'
C                   MOVE      *ON           *INLR
C                   RETURN
C                   ENDIF

*                  ** Bail out if old record does not exist
*                  ** matching record. No need to update keywords.
C                   IF        *IN33 = *ON
C                   EVAL      ERRRTN = '1'
C                   MOVE      *ON           *INLR
C                   RETURN
C                   ENDIF

*                  ** If old document exists.
*                  ** Save keywords 2 - 10 to work fields
C                   Eval      WKEYWORD2  = %trimr(KEYWORD2)
C                   Eval      WKEYWORD3  = %trimr(KEYWORD3)
C                   Eval      WKEYWORD4  = %trimr(KEYWORD4)
C                   Eval      WKEYWORD5  = %trimr(KEYWORD5)
C                   Eval      WKEYWORD6  = %trimr(KEYWORD6)
C                   Eval      WKEYWORD7  = %trimr(KEYWORD7)
C                   Eval      WKEYWORD8  = %trimr(KEYWORD8)
C                   Eval      WKEYWORD9  = %trimr(KEYWORD9)
C                   Eval      WKEYWORD10 = %trimr(KEYWORD10)

*                  ** Retreive new DOCID record and update new keywords 2-10
*                  ** based on the previous checkin values.
C     IDOCKEY       CHAIN     DOCS01                             34

*                  ** Bail out if record does not exist
C                   IF        *IN34 = *ON
C                   EVAL      ERRRTN = '1'
C                   MOVE      *ON           *INLR
C                   RETURN
C                   ENDIF

*                  ** Move keywords 2 - 10 to current doc fields
C                   Eval      KEYWORD2  = %trimr(WKEYWORD2)
C                   Eval      KEYWORD3  = %trimr(WKEYWORD3)
C                   Eval      KEYWORD4  = %trimr(WKEYWORD4)
C                   Eval      KEYWORD5  = %trimr(WKEYWORD5)
C                   Eval      KEYWORD6  = %trimr(WKEYWORD6)
C                   Eval      KEYWORD7  = %trimr(WKEYWORD7)
C                   Eval      KEYWORD8  = %trimr(WKEYWORD8)
C                   Eval      KEYWORD9  = %trimr(WKEYWORD9)
C                   Eval      KEYWORD10 = %trimr(WKEYWORD10)

*                  ** Update doc info
C                   UPDATE    DOCS00R

C*                  ** Exit after adding new record
C                   MOVE      *ON           *INLR
C                   RETURN
 

Updating Search Keys with Information from Non-iSeries Databases

You may want to scan incoming documents with search-key information such as the customer number, invoice number, PO number, and so on, and then have an exit program retrieve information from a business application after check-in. You can use the DOCEXITC exit point, as described in the previous section, with an RPG or COBOL program and RPG2SQL to retrieve information after check-in from any database you can access with ODBC. For example: MySQL, SQL Server, Oracle, Sybase, Filemaker, MS Access, and so on. Using RPG2SQL with WebDocs iSeries allows you to automatically index documents with information from multiple business systems.

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

Last Modified On: December 10, 2016