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.
Hinweis: 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:
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.
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.
Creating a .NET client assembly that uses data over HTTPTo
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 assemblyPlace 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.
In the Project menu, select Add Reference.
Click the .NET tab.
Click Browse and locate the DocumentService.dll file.
Click Select and then click OK.
Invoking a service using a .NET client assembly that uses BLOB data over HTTPYou 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:
Create the .NET client
assembly.
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.
Using the Microsoft .NET client assembly, create a MyApplication_EncryptDocumentService object
by invoking its default constructor.
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.
Create a BLOB object by using its constructor.
The BLOB object is used to pass data to the MyApplication/EncryptDocument process.
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.
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.
Create a System.UriBuilder object by using
its constructor and passing the value of the returned BLOB object’s remoteURL data
member.
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.)
Create a byte array and populate it with the data located
in the System.IO.Stream object.
Create a System.IO.BinaryWriter object by
invoking its constructor and passing the System.IO.FileStream object.
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 HTTPYou 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:
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.
Hinweis: Replace hiro-xp with the IP address of the J2EE application server hosting LiveCycle.
Package the Java proxy classes created using using JAX-WS
into a JAR file.
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.
Create a MyApplicationEncryptDocumentService object
by using its constructor.
Create a MyApplicationEncryptDocument object
by invoking the MyApplicationEncryptDocumentService object’s getEncryptDocument method.
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);
Create a BLOB object by using its constructor.
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.
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.
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).
Create a java.io.File object by using its
constructor. This object represents the encrypted PDF document.
Create a java.io.FileOutputStream object
by using its constructor and passing the java.io.File object.
Invoke the java.io.FileOutputStream object’s write method.
Pass the byte array that contains the data stream that represents
the encrypted PDF document.
|
|
|