Take a survey

Invoking LiveCycle ES > Invoking LiveCycle ES Using the Java API

Invoking LiveCycle ES Using the Java API
Services can be invoked using a Java API. When using the Java API, you can either use the Invocation API or Java client libraries. Java client libraries are available for services such as Rights Management. These APIs are strongly-typed and enable you to develop Java applications that invoke services.
The Invocation API refers to classes that are located in the com.adobe.idp.dsc package. Using these classes, you can send an invocation request directly to a service and handle an invocation response that is returned. Use the Invocation API to invoke short-lived or long-lived processes that were created using Workbench ES.
The recommended way to programmatically invoke a service is to use a Java client library that corresponds to the service that you want to invoke. You instantiate a Java object that represents the service. To perform a service operation, you invoke a method that belongs to the Java object.
The Java API supports the following features:
Note: This section describes using both the Invocation API and a Java client library to invoke services. In addition to using the Java API to programmatically invoke services, you can also use web services. For information, see Invoking LiveCycle ES Using Web Services.
Note: VM invocation is meant for service invocation. That is, when one service invokes another service. You should only use the invocation method when creating custom services. This is beyond the scope of this section.
Note: To prevent a memory leak in WebLogic while using a com.adobe.idp.Document object, you must read the document information in chunks of 2048 bytes or less. For example, the following code reads the document information in chunks of 2048 bytes:
    // Set up the chunk size to prevent a potential memory leak
    int buffSize = 2048;
 
    // Determine the total number of bytes to be read
    int docLength = (int) inDoc.length();
    byte [] byteDoc = new byte[docLength];
 
    // Set up the reading position
    int pos = 0;
 
    // Loop through the document information, 2048 bytes at a time
    while (docLength > 0) {
 
        // Read the next chunk of information
        int toRead = Math.min(buffSize, docLength);
        int bytesRead = inDoc.read(pos, byteDoc, pos, toRead);
 
        // Handle the exception in case data retrieval failed
        if (bytesRead == -1) {
 
            inDoc.doneReading();
            inDoc.dispose();
            throw new RuntimeException("Data retrieval failed!");
 
        }
 
        // Update the reading position and number of bytes remaining
                   pos += bytesRead;
        docLength -= bytesRead;
 
    }
 
    // The document information has been successfully read
    inDoc.doneReading();
    inDoc.dispose();

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/invokingJava.22.1.html