You can programmatically add content to LiveCycle Content
Services (Deprecated) by using the Document Management (Deprecated)
Java or web service API. Consider the MortgageForm.pdf file shown
in this illustration.
Using the Document Management API, you can add content such as
the MortgageForm.pdf file to a space such as Company Home/Test Directory.
After you add content, it becomes accessible to all clients that
can access Content Services (deprecated).
To limit the file size, you can create application logic in your
client application to prevent a file over a certain size from being
added. For example, to exclude files exceeding 25 MB, check the
file size in your Java or web service application. If it exceeds
25 MB, do not add it to Content Services (deprecated).
The web service quick starts that correspond to the Document
Management service use the following WSDL:
http://localhost:8080/soap/services/DocumentManagementService?WSDL&lc_version=9.0.1
For more information about the Document Management service, see
Services Reference for LiveCycle
.
Note:
Adobe is migrating Content Services ES customers
to the Content Repository built on the modern, modular CRX architecture,
acquired during the Adobe acquisition of Day Software. The Content
Repository is provided with LiveCycle Foundation and is available
as of the LiveCycle ES4 release.
Summary of steps
To add content to Content Services (deprecated), follow
these steps:
-
Include project files.
-
Create the service client.
-
Retrieve the content to add.
-
Set content attributes.
-
Upload the content.
Include project files
Include the necessary files in your development
project. If you are using Java to create a client application, include
the necessary JAR files. If you are using web services, include
the proxy files.
Add the following JAR files to your project’s
class path:
-
adobe-livecycle-client.jar
-
adobe-usermanager-client.jar
-
adobe-contentservices-client.jar
-
adobe-utilities.jar (required if LiveCycle is deployed on
JBoss)
-
jbossall-client.jar (required if LiveCycle is deployed on
JBoss)
Note:
These JAR files are required
if you are using the EJB connection mode. If you are using the SOAP
connection mode, include additional JAR files.
Create the service client
Before you can programmatically add
content, establish a connection and provide credentials. This task
is accomplished by creating a service client.
Retrieve the content to add
Retrieve the content to add to Content
Services (deprecated). You can add various file formats such as
XML, PDF, and image files. An exception is thrown if you attempt
to add content that exists.
Set content attributes
Content attributes enable users to
view details about the content in the web client. For example, a
user can view the creator and description that is related to the
content. Most of the attributes do not have an impact on the content
that is added. These properties are considered read-only. The following
list describes the attributes:
-
{http://www.alfresco.org/model/content/1.0}creator
:
Specifies the creator of the content
-
{http://www.alfresco.org/model/content/1.0}browse-link
:
Specifies a link to where the content is stored
-
{http://www.alfresco.org/model/system/1.0}store-protocol
:
Specifies the type of store that is used for the content
-
{http://www.alfresco.org/model/content/1.0}title
:
Specifies a title that is displayed in the web client for the content
-
{http://www.alfresco.org/model/system/1.0}node-uuid
:
Specifies a unique identifier value for the content
-
{http://www.alfresco.org/model/content/1.0}node-type
:
Specifies the cotent type
-
{http://www.alfresco.org/model/content/1.0}folder-path
:
Specifies the content path
-
{http://www.alfresco.org/model/system/1.0}store-identifier
:
Specifies a unique identifier value for the store
-
{http://www.alfresco.org/model/content/1.0}description
:
Specifies a description for the content
-
{http://www.alfresco.org/model/content/1.0}resolved-path
:
Specifies the fully resolved path with namespaces
It
is recommended that you set properties that are displayed in the
web client, including title, creator, and description.
Note:
The Add content to Content Services (deprecated)
quick start shows how to set the title, creator, and description
attributes.
Upload the content
After you retrieve the content and set attributes,
you can upload the content to Content Services (deprecated). After
the content is uploaded, it becomes available to users. When content
is successfully uploaded, you can retrieve an identifier value for
the new content.
Add content to Content Services (deprecated) ES2 using the Java API
Add content to Content Services (deprecated) by using the
Document Management Service API (Java):
-
Include project files.
Include client JAR files,
such as adobe-contentservices-client.jar, in your Java project’s
class path.
-
Create the service client.
-
Retrieve the content to add.
-
Create a
java.io.FileInputStream
object
that represents the content to add by using its constructor. Pass
a string value that specifies the file location.
-
Create a
com.adobe.idp.Document
object by
using its constructor. Pass the
java.io.FileInputStream
object.
This object represents the content to add.
-
Set content attributes.
-
Create a
java.util.Map
object
that stores content attributes by using a
HashMap
constructor.
-
For each attribute to set, invoke the
java.util.Map
object’s
put
method.
Pass the following arguments:
-
A string value that
represents the key name. For example, to set the description attribute,
pass the value
{http://www.alfresco.org/model/content/1.0}description
.
-
A string value that specifies the attribute value (for example,
a mortgage application form).
-
Upload the content.
Add the content by invoking the
DocumentManagementServiceClientImpl
object’s
storeContent
method
and passing the following values:
-
A string value that
specifies the store where the content is added. The default store
is
SpacesStore
. This value is a mandatory parameter.
-
A string value that specifies the fully qualified path of
the space where the content is added (for example,
/Company Home/Test Directory
). This
value is a mandatory parameter.
-
The node name that represents the new content (for example,
MortgageForm.pdf
).
This value is a mandatory parameter.
-
A string value that specifies the node type. To add new content,
such as a PDF file, specify
{http://www.alfresco.org/model/content/1.0}content
. This
value is a mandatory parameter.
-
A
com.adobe.idp.Document
object that represents
the content. This value is a mandatory parameter.
-
A string value that specifies the encoding value (for example,
UTF-8
).
This value is a mandatory parameter.
-
An
UpdateVersionType
enumeration value that
specifies how to handle version information (for example,
UpdateVersionType.INCREMENT_MAJOR_VERSION
to
increment the content version. ) This value is a mandatory parameter.
-
A
java.util.List
instance that specifies
aspects related to the content. This value is an optional parameter
and you can specify
null
.
-
A
java.util.Map
object that stores content
attributes.
The
storeContent
method
returns a
CRCResult
object that describes the content.
Using a
CRCResult
object, you can, for example,
obtain the content’s unique identifier value. To perform this task,
invoke the
CRCResult
object’s
getNodeUuid
method.
Add content to Content Services (deprecated) ES2 using the web service API
Add content to Content Services (deprecated)
by using the Document Management Service API (web service):
-
Include project files.
Create a Microsoft .NET
client project that uses MTOM and consumes the Document Management
WSDL.
-
Create the service client.
-
Create a
DocumentManagementServiceClient
object
by using its default constructor.
-
Create a
DocumentManagementServiceClient.Endpoint.Address
object
by using the
System.ServiceModel.EndpointAddress
constructor.
Pass a string value that specifies the WSDL to the LiveCycle service,
such as
http://localhost:8080/soap/services/DocumentManagementService
.
You do not need to use the
lc_version
attribute.
This attribute is used when you create a service reference.
-
Create a
System.ServiceModel.BasicHttpBinding
object
by using the value of the
DocumentManagementServiceClient.Endpoint.Binding
field.
Cast the return value to
BasicHttpBinding
.
-
Set the
System.ServiceModel.BasicHttpBinding
object’s
MessageEncoding
field
to
WSMessageEncoding.Mtom
. This value ensures that
MTOM is used.
-
Enable basic HTTP authentication by performing the following
tasks:
-
Assign the AEM forms user name to the field
DocumentManagementServiceClient.ClientCredentials.UserName.UserName
.
-
Assign the corresponding password value to the field
DocumentManagementServiceClient.ClientCredentials.UserName.Password
.
-
Assign the constant value
HttpClientCredentialType.Basic
to the
field
BasicHttpBindingSecurity.Transport.ClientCredentialType
.
-
Assign the constant value
BasicHttpSecurityMode.TransportCredentialOnly
to
the field
BasicHttpBindingSecurity.Security.Mode
.
-
Retrieve the content to add.
-
Create a
BLOB
object
by using its constructor. The
BLOB
object is used
to store a PDF document that is uploaded to Content Services (deprecated).
-
Create a
System.IO.FileStream
object by
invoking its constructor. Pass a string value that represents the
file location of the PDF document and the mode in which to open
the file.
-
Create a byte array that stores the content of the
System.IO.FileStream
object.
You can determine the size of the byte array by getting the
System.IO.FileStream
object’s
Length
property.
-
Populate the byte array with stream data by invoking the
System.IO.FileStream
object’s
Read
method.
Pass the byte array, the starting position, and the stream length
to read.
-
Populate the
BLOB
object by assigning the
contents of the byte array to the
BLOB
object’s
MTOM
field.
-
Set content attributes.
-
Create a
MyMapOf_xsd_string_To_xsd_anyType
object
that stores content attributes by using its constructor.
-
For each attribute to set, create a
MyMapOf_xsd_string_To_xsd_anyType_Item
object
by using its constructor. Set the attribute value by perform the
following tasks:
-
Set the
MyMapOf_xsd_string_To_xsd_anyType_Item
object’s
key
field.
Assign a string value that represents the key name. For example,
to set the description attribute, assign the following value
{http://www.alfresco.org/model/content/1.0}description
.
-
Set the
MyMapOf_xsd_string_To_xsd_anyType_Item
object’s
value
field.
Assign a string value that specifies the attribute value. For example,
a mortgage application form.
-
For each attribute to set, invoke the
MyMapOf_xsd_string_To_xsd_anyType
object’s
Add
method
and pass a
MyMapOf_xsd_string_To_xsd_anyType_Item
object.
-
Upload the content.
Add the content by invoking the
DocumentManagementServiceClient
object’s
storeContentAPI
method
and passing the following values:
-
A string value that
specifies the store where the content is added. The default store
is
SpacesStore
. This value is a mandatory parameter.
-
A string value that specifies the fully qualified path of
the space where the content is added (for example,
/Company Home/Test Directory
). This
value is a mandatory parameter.
-
The node name that represents the new content (for example,
MortgageForm.pdf
).
This value is a mandatory parameter.
-
A string value that specifies the node type. To add new content,
such as a PDF file, specify
{http://www.alfresco.org/model/content/1.0}content
.
-
A
BLOB
object that represents the content.
This value is a mandatory parameter.
-
A string value that specifies the encoding value (for example,
UTF-8
).
-
An
UpdateVersionType
enumeration value that
specifies how to handle version information. The
UpdateVersionType.INCREMENT_MAJOR_VERSION
value
is used to increment the content version.
-
A
MyArrayOf_xsd_string
instance that specifies
aspects related to the content. This value is an optional parameter
and you can specify
null
.
-
A
MyMapOf_xsd_string_To_xsd_anyType
object
that stores content attributes.
-
An empty string value that is used to handle the browse link
output value.
-
An empty
CRCResult
object that describes
the content. This parameter handles the output value. For example,
you can obtain the content’s unique identifier value by invoking
the
CRCResult
object’s
getNodeUuid
method.
|
|
|