Dr. LAPI - LAPI for Dummies

The Livelink Application Programming Interface is a programming doorway into OpenTextís flag ship collaboration product called Livelink. Livelink is used by major and minor organizationís worldwide to offer their customers a range of functionality including :

It is good to understand a little about the product before you embark on any programming using that product, so I recommend that you spend sometime using Livelink to get to know how it works and get used to the way in which it does things, this will greatly aid any development that you attempt. Livelink is written in C++ and that is why it is enterprise scalable. It works with any major HTTP (Web) server and any has a choice of databases - including Oracle and SQL server.

OpenText uses an Object Oriented developer paradigm where the complexity of their code is replaced with simple re-usable classes, the most common way to interact with Livelink as a developer is using the Builder or SDK. The language of choice for any major livelink development will probably be OScript at present, although Java (J2EE) is gaining ground as a suitable alternative.

For example, when you issue a login to the Livelink system, it is nothing more than a form submission to a Livelink CGI executable, ISAPI DLL or JSP Container on a HTTP server. Once received by Livelink, the call is transferred to an Object Space called webll and a corresponding request handler called GetLogin. The Livelink server then uses the concept of a "Virtual Machine" - called the Ospace Virtual Machine - and translates the call into commands to other parts of the system and the database.

The SDK / Builder, when installed on a Livelink server provides a way of examining the contents of the system, a limited app server and a debugger. LAPI is merely gives external visibility of the APIís in the code Livelink code. The language that you use to build you LAPI application in could be anything from .Net to Java or even C/C++, as all that changes is the way you connect to the Livelink instance, the functions and their parameters remain constant regardless of language used. Therefore, you don't need to be proficient at OScript to work with Livelink.

To start developing with LAPI, you need a fully working Livelink instance, onto which you have installed the LAPI module and the Livelink Builder, and a database for your Livelink instance to use. If you want to use Java for your LAPI development, you will also need to add the path to the LAPI's bin directory to your classpath.

Now that we are ready to start LAPI development - for which we will be using a text editor - such as NotePad, TextPad or VI. We will create a simple LAPI program in Java, which we will call TestAddDocument.java, which can be found here. Lets go though the code and see what each part does :

import com.opentext.api.*;
public class TestAddDocument
    private static String Server = "localhost";
    private static int Port = 2099;
    private static String DFT = "";
    private static String User = "Admin";
    private static String Pass = "cafadmin";

We start by importing the LAPI classes, then we declare some global variables for our Livelink instance :

public static void main (String [] args)
        LLSession session;
        LAPI_DOCUMENTS doc;
        LLValue entInfo= new LLValue();
        LLValue objInfo = new LLValue();
        LLValue verInfo = new LLValue();
        session = new LLSession (Server, Port, DFT, User, Pass);
        doc = new LAPI_DOCUMENTS (session);

Next, we create our Livelink Session Object - LLSession - and some variables that we will need to hold the output of the Livelink functions that we will call. Then we connect to the specified Livelink instance and create our session to the Livelink instance.

        int volumeID,objectID,objID;
        String objName, FilePath;
        if(doc.AccessEnterpriseWS(entInfo) != 0)
            System.out.println("AccessEnterpriseWS Failed.");
            volumeID = entInfo.toInteger("VolumeID");
            objectID = entInfo.toInteger("ID");
            System.out.println("Enterprise Volume"+volumeID+"Enterprise ObjID"+objectID);
        objID = 41613;
        objName = "New Document";
        FilePath = "C:\\temp\\AddDocument.java";

Now we try and connect to the Enterprise Workspace of out Livelink instance. Then we create the parameters that we will need to use to add our document to Livelink, firstly the Object ID (in this case 41613) of a container in Livelink - e.g. a Folder, Project or Compound Document - in which we want to add our new document, a Name for Livelink to use for this new document and the full path to this document so that Livelink can load it.

        if (doc.AddDocument(volumeID, objID, objName, FilePath, objInfo, verInfo) == 0)
            System.out.println("This version's name is"+verInfo.toString("Name"));
            System.out.println("This version's created at "+objInfo.toDate("CreateDate"));
            System.out.println("This objects id is"+verInfo.toInteger("NodeID"));
            System.out.println("Document Added Successfully");
            System.out.println("Failed to Add Document");
            //Error Checking
            System.out.println("Status Code: " + session.getStatus());
            System.out.println("Api Error: " + session.getApiError());
            System.out.println("Error Message: " + session.getErrMsg());
            System.out.println("Status Message: " + session.getStatusMessage());
    catch (Throwable e)
        e.printStackTrace (System.err);

Now we attempt to add our new Document to Livelink and then we examine the return value from that function, if it is 0 then we have added the document successfully, so we can display some information about it. Otherwise, the add failed, so we display some debugging information about the event to assist the developer. The syntax of the AddDocument function is as follows for Java and .Net :

public int AddDocument(
    int parentVolID,
    int parentID,
    String name,
    String filePath,
    LLValue objectInfo,
    LLValue versionInfo

Then finally, we close the methods off :

    }//main ends
}//class ends

We have now written a working LAPI program, all that is left is to compile and run it - once you've put the correct values in for the various variables of course. This example, and the many more in the LAPI section of this site and elsewhere should provide you with a good starting place for you own endeavours in the wonderful world of LAPI.
Website Designed by Adservio Consulting Valid HTML 4.01 Strict    Valid CSS!    Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0