Invoking LiveCycle using BLOB data over HTTP

You can invoke LiveCycle services using web services and passing BLOB data over HTTP. Passing BLOB data over HTTP is an alternative technique instead of using base64 encoding, DIME, or MIME. For example, you can pass data over HTTP in a Microsoft .NET project that uses Web Service Enhancement 3.0, which does not support DIME or MIME. When using BLOB data over HTTP, input data is uploaded before the LiveCycle service is invoked.

"Invoking LiveCycle using BLOB Data over HTTP" discusses invoking the following LiveCycle short-lived process named MyApplication/EncryptDocument by passing BLOB data over HTTP.

Remarque : This process is not based on an existing LiveCycle process. To follow along with the code example, create a process named MyApplication/EncryptDocument using Workbench. (See Using Workbench.)

When this process is invoked, it performs the following actions:

  1. Obtains the unsecured PDF document that is passed to the process. This action is based on the SetValue operation. The input parameter for this process is a document process variable named inDoc.

  2. Encrypts the PDF document with a password. This action is based on the PasswordEncryptPDF operation. The password encrypted PDF document is returned in a process variable named outDoc.

Remarque : It is recommended that you be familiar with Invoking LiveCycle using SOAP. (See Invoking LiveCycle using Web Services.)

Creating a .NET client assembly that uses data over HTTP

To create a client assembly that uses data over HTTP, follow the process specified in Invoking LiveCycle using Base64 encoding. However, amend the URL in the proxy class to include ?blob=http instead of ?blob=base64. This action ensures that data is passed over HTTP. In the proxy class, locate the following line of code:

"http://localhost:8080/soap/services/MyApplication/EncryptDocument";

and change it to:

"http://localhost:8080/soap/services/MyApplication/EncryptDocument?blob=http";

Referencing the .NET clienMyApplication/EncryptDocumentt assembly

Place your new .NET client assembly on the computer where you are developing your client application. After you place the .NET client assembly in a directory, you can reference it from a project. Reference the System.Web.Services library from your project. If you do not reference this library, you cannot use the .NET client assembly to invoke a service.

  1. In the Project menu, select Add Reference.

  2. Click the .NET tab.

  3. Click Browse and locate the DocumentService.dll file.

  4. Click Select and then click OK.

Invoking a service using a .NET client assembly that uses BLOB data over HTTP

You can invoke the MyApplication/EncryptDocument service (which was built in Workbench) using a .NET client assembly that uses data over HTTP. To invoke the MyApplication/EncryptDocument service, perform the following steps:

  1. Create the .NET client assembly.

  2. Reference the Microsoft .NET client assembly. Create a client Microsoft .NET project. Reference the Microsoft .NET client assembly in the client project. Also reference System.Web.Services.

  3. Using the Microsoft .NET client assembly, create a MyApplication_EncryptDocumentService object by invoking its default constructor.

  4. Set the MyApplication_EncryptDocumentService object’s Credentials property with a System.Net.NetworkCredential object. Within the System.Net.NetworkCredential constructor, specify a LiveCycle user name and the corresponding password. Set authentication values to enable your .NET client application to successfully exchange SOAP messages with LiveCycle.

  5. Create a BLOB object by using its constructor. The BLOB object is used to pass data to the MyApplication/EncryptDocument process.

  6. Assign a string value to the BLOB object’s remoteURL data member that specifies the URI location of a PDF document to pass to the MyApplication/EncryptDocument service.

  7. Invoke the MyApplication/EncryptDocument process by invoking the MyApplication_EncryptDocumentService object’s invoke method and passing the BLOB object. This process returns an encrypted PDF document within a BLOB object.

  8. Create a System.UriBuilder object by using its constructor and passing the value of the returned BLOB object’s remoteURL data member.

  9. Convert the System.UriBuilder object to a System.IO.Stream object. (The C# Quick Start that follows this list illustrates how to perform this task.)

  10. Create a byte array and populate it with the data located in the System.IO.Stream object.

  11. Create a System.IO.BinaryWriter object by invoking its constructor and passing the System.IO.FileStream object.

  12. Write the byte array contents to a PDF file by invoking the System.IO.BinaryWriter object’s Write method and passing the byte array.

Invoking a service using Java proxy classes and BLOB data over HTTP

You can invoke a LiveCycle service using Java proxy classes and BLOB data over HTTP. To invoke the MyApplication/EncryptDocument service using Java proxy classes, perform the following steps:

  1. Create Java proxy classes using JAX-WS that consumes the MyApplication/EncryptDocument service WSDL. Use the following WSDL endpoint:

    http://hiro-xp:8080/soap/services/MyApplication/EncryptDocument?WSDL&lc_version=9.0.1

    For information, see Creating Java proxy classes using JAX-WS.

    Remarque : Replace hiro-xp with the IP address of the J2EE application server hosting LiveCycle.
  2. Package the Java proxy classes created using using JAX-WS into a JAR file.

  3. Include the Java proxy JAR file and the JAR files located in the following path:

    <Install Directory>\Adobe\Adobe LiveCycle ES4\sdk\client-libs\thirdparty

    into your Java client project’s class path.

  4. Create a MyApplicationEncryptDocumentService object by using its constructor.

  5. Create a MyApplicationEncryptDocument object by invoking the MyApplicationEncryptDocumentService object’s getEncryptDocument method.

  6. Set the connection values required to invoke LiveCycle by assigning values to the following data members:

    • Assign the WSDL endpoint and the encoding type to the javax.xml.ws.BindingProvider object’s ENDPOINT_ADDRESS_PROPERTY field. To invoke the MyApplication/EncryptDocument service using BLOB over HTTP encoding, specify the following URL value:

      http://hiro-xp:8080/soap/services/MyApplication/EncryptDocument?blob=http

    • Assign the LiveCycle user to the javax.xml.ws.BindingProvider object’s USERNAME_PROPERTY field.

    • Assign the corresponding password value to the javax.xml.ws.BindingProvider object’s PASSWORD_PROPERTY field.

    The following code example shows this application logic:

    //Set connection values required to invoke LiveCycle 
    String url = "http://hiro-xp:8080/soap/services/MyApplication/EncryptDocument?blob=http"; 
    String username = "administrator"; 
    String password = "password"; 
    ((BindingProvider) encryptDocClient).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); 
    ((BindingProvider) encryptDocClient).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, username); 
    ((BindingProvider) encryptDocClient).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);
  7. Create a BLOB object by using its constructor.

  8. Populate the BLOB object by invoking its setRemoteURL method. Pass a string value that specifies the URI location of a PDF document to pass to the MyApplication/EncryptDocument service.

  9. Invoke the MyApplication/EncryptDocument process by invoking the MyApplicationEncryptDocument object’s invoke method and passing the BLOB object that contains the PDF document. This process returns an encrypted PDF document within a BLOB object.

  10. Create a byte array to store the data stream that represents the encrypted PDF document. Invoke the BLOB object’s getRemoteURL method (use the BLOB object returned by the invoke method).

  11. Create a java.io.File object by using its constructor. This object represents the encrypted PDF document.

  12. Create a java.io.FileOutputStream object by using its constructor and passing the java.io.File object.

  13. Invoke the java.io.FileOutputStream object’s write method. Pass the byte array that contains the data stream that represents the encrypted PDF document.