LiveCycle service operations can be invoked by using a
service’s strongly typed API, which is known as a Java client library.
A Java client library is a set of concrete classes that provide
access to services deployed in the service container. You instantiate
a Java object that represents the service to invoke instead of creating an InvocationRequest object
by using the Invocation API. The Invocation API is used to invoke
processes, such as long-lived processes, created in Workbench. (See Invoking Human-Centric Long-Lived Processes.)
To perform a service operation, invoke a method that belongs
to the Java object. A Java client library contains methods that
typically map one-to-one with service operations. When using a Java
client library, set required connection properties. (See Setting connection properties.)
After you set connection properties, create a ServiceClientFactory object that
is used to instantiate a Java object that lets you invoke a service.
Each service that has a Java client library has a corresponding
client object. For example, to invoke the Repository service, create
a ResourceRepositoryClient object by using its
constructor and passing the ServiceClientFactory object.
The ServiceClientFactory object is responsible
for maintaining connection settings that are required to invoke
Although obtaining a ServiceClientFactory is
typically fast, some overhead is involved when the factory is first
used. This object is optimized for reuse and therefore, when possible,
use the same ServiceClientFactory object when you
are creating multiple Java client objects. That is, do not create
a separate ServiceClientFactory object for each
client library object that you create.
There is a User Manager setting that controls the lifetime of
the SAML assertion that is inside the com.adobe.idp.Context object
that affects the ServiceClientFactory object. This
setting controls all authentication context lifetimes throughout
LiveCycle, including all invocations performed by using the Java
API. By default, the time period in which a ServiceCleintFactory object
can be used is two hours.
Note: To explain how to invoke a service by using
the Java API, the Repository service’s writeResource operation
is invoked. This operation places a new resource into the repository.
You can invoke the Repository service by using a Java client
library and by performing the following steps:
Include client JAR files, such as the adobe-repository-client.jar,
in your Java project’s class path. For information about the location
of these files, see Including LiveCycle Java library files.
Set connection properties that are required to invoke a service.
Create a ServiceClientFactory object by
invoking the ServiceClientFactory object’s static createInstance method
and passing the java.util.Properties object that
contains connection properties.
Create a ResourceRepositoryClient object
by using its constructor and passing the ServiceClientFactory object.
Use the ResourceRepositoryClient object to invoke
Repository service operations.
Create a RepositoryInfomodelFactoryBean object
by using its constructor and pass null. This object
lets you create a Resource object that represents
the content that is added to the repository.
Create a Resource object by invoking the RepositoryInfomodelFactoryBean object’s newImage method
and passing the following values:
A unique ID value
by specifying new Id().
A unique UUID value by specifying new Lid().
The name of the resource. You can specify the file name of
the XDP file.
Cast the return value to Resource.
Create a ResourceContent object by invoking
the RepositoryInfomodelFactoryBean object’s newImage method
and casting the return value to ResourceContent.
This object represents the content that is added to the repository.
Create a com.adobe.idp.Document object by
passing a java.io.FileInputStream object that stores
the XDP file to add to the repository. (See Creating a document based on an InputStream object.)
Add the content of the com.adobe.idp.Document object
to the ResourceContent object by invoking the ResourceContent object’s setDataDocument method.
Pass the com.adobe.idp.Document object.
Set the MIME type of the XDP file to add to the repository
by invoking the ResourceContent object’s setMimeType method
and passing application/vnd.adobe.xdp+xml.
Add the content of the ResourceContent object
to the Resource object by invoking the Resource object
‘s setContent method and passing the ResourceContent object.
Add a description of the resource by invoking the Resource object
‘s setDescription method and passing a string value
that represents a description of the resource.
Add the form design to the repository by invoking the ResourceRepositoryClient object’s writeResource method
and passing the following values: