You can invoke a LiveCycle ES service using DIME. To fully explain how to do this task, this section describes how to invoke the EncryptDocument process. This process accepts an unsecure PDF document and returns a password-encrypted PDF document.
1. Create a Microsoft .NET project that enables you to invoke a LiveCycle ES service using DIME. Ensure that you include Web Services Enhancements 2.0 and create a web reference to the LiveCycle ES service. (See Creating a .NET project that uses DIME.)
2. After setting a web reference to the EncryptDocument process, create an EncryptDocumentServiceWse object by using its default constructor.
3. Set the EncryptDocumentServiceWse object’s Credentials data member with a System.Net.NetworkCredential value that specifies the LiveCycle ES user name and password value.
4. Create a Microsoft.Web.Services2.Dime.DimeAttachment object by using its constructor and passing the following values:
• A string value that specifies a GUID value. You can obtain a GUID value by invoking the System.Guid.NewGuid.ToString method.
• A string value that specifies the content type. Because this process requires a PDF document, specify application/pdf.
•
•
5. Create a BLOB object by using its constructor.
6. Add the DIME attachment to the BLOB object by assigning the Microsoft.Web.Services2.Dime.DimeAttachment object’s Id data member value to the BLOB object’s attachmentID data member.
7. Invoke the EncryptDocumentServiceWse.RequestSoapContext.Attachments.Add method and pass the Microsoft.Web.Services2.Dime.DimeAttachment object.
8. Invoke the EncryptDocument process by invoking the EncryptDocumentServiceWse object’s invoke method and passing the BLOB object that contains the DIME attachment. This process returns an encrypted PDF document within a BLOB object.
9. Obtain the attachment identifier value by getting the value of the returned BLOB object’s attachmentID data member.
10. Iterate through the attachments located in EncryptDocumentServiceWse.ResponseSoapContext.Attachments and use the attachment identifier value to obtain the encrypted PDF document.
11. Obtain a System.IO.Stream object by getting the value of the Attachment object’s Stream data member.
12. Create a byte array and pass that byte array to the System.IO.Stream object’s Read method. This method populates the byte array with a data stream that represents the encrypted PDF document.
13. Create a System.IO.FileStream object by invoking its constructor and passing a string value that represents a PDF file location. This object represents the encrypted PDF document.
14. Create a System.IO.BinaryWriter object by invoking its constructor and passing the System.IO.FileStream object.
15. Write the contents of the byte array to the PDF file by invoking the System.IO.BinaryWriter object’s Write method and passing the byte array.
| Programming with LiveCycle ES (LiveDocs) |
| Adobe LiveCycle ES Update 1 |
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000280.html