Highlighted

web service component

neptas

17-12-2008

Heelo,



Is there any good doccumentation or any working example about using the webservice component in workflow (8.2)?



Thank you

Replies

Highlighted

_MEHUL_PARESHBH

02-02-2009

GetMortgageForm process

The following illustration shows the GetMortgageForm process (see Figure 2).



Figure 2. A LiveCycle ES process that returns an interactive form.

Note: This document does not describe how to create a process by using Adobe LiveCycle Workbench ES. (For information, see Workbench ES Help.)

The following table describes the steps in this diagram.

Operation Description

1 The user submits a custom identifier value and the operation to perform. In this situation, assume that the user is applying for a mortgage. The input parameters for this process are a string value that specifies the form name (named formName) and another string value that represents the custom identifier value (named custId).

Note: In the Java application logic located in the Java servlet, the formName and custId process variables are referenced.

2 The process uses the customer identifier value to perform a relational database look-up for additional customer information by using the JdbcService service's Execute SQL Statement operation. The custom identifier value acts as the primary key value.

3 Merges customer data into an XML data source that is used to prepopulate the form. (See "Prepopulating Dynamic Forms" in Programming with LiveCycle ES.)



4 The mortgage form is rendered with customer data located in some of the fields, such as the address field. This action is based on the Forms service's renderPDFForm operation.

The Java servlet receives the form (return value for the process) and writes the form to a client web browser. The name of the output parameter is RenderedForm. This parameter is a process variable and its data type is FormsResult.

Note: In the Java application logic located in the Java servlet that invokes this process, the RenderedForm process variable is referenced.

This interactive loan form is rendered by the GetMortgageForm process (see Figure 3).



Figure 3. An interactive form.

Note: This document describes how to use the Invocation API to invoke a LiveCycle ES process. It is recommended that you are familiar with the Invocation API before you follow along with this document. (See "Invoking LiveCycle ES Processes" in Programming with LiveCycle ES.)

Summary of steps

To create a Java servlet that invokes a LiveCycle ES process, perform the following steps:

1. Create a new web project.

2. Create Java application logic that represents the Java servlet.

3. Create the web page for the web application.

4. Package the web application to a WAR file.

5. Deploy the WAR file to the J2EE application server.

6. Test your web application.

Note: Some of these steps depend on the J2EE application on which LiveCycle ES is deployed. For example, the method you use to deploy a WAR file depends on the J2EE application server that you are using. This document assumes that LiveCycle ES is deployed on JBoss®.

Creating a web project

The first step to create a Java servlet that can invoke a LiveCycle ES process is to create a new web project. The Java IDE that this document is based on is Eclipse 3.3. Using the Eclipse IDE, create a web project and add the required JAR files to your project. Finally, add an HTML page named index.html and a Java servlet to your project.

The following list specifies the JAR files that you must add to your web project:

adobe-forms-client.jar

adobe-livecycle-client.jar

adobe-usermanager-client.jar

adobe-utilities.jar

For the location of these JAR files, see "Including LiveCycle ES Java library files" in Programming with LiveCycle ES.

Note: The adobe-forms-client.jar file is required because the process returns a FormsResult object, which is defined in this JAR file.

To create a web project:

1. Start Eclipse and click File > New Project.

2. In the New Project dialog box, select Web > Dynamic Web Project.

3. Type InvokeMortgageProcess for the name of your project and then click Finish.

To add required JAR files to your project:

1. From the Project Explorer window, right-click the InvokeMortgageProcess project and select Properties.

2. Click Java build path and then click the Libraries tab.

3. Click the Add External JARs button and browse to the JAR files to include.

To add a Java servlet to your project:

1. From the Project Explorer window, right-click the Invoke Mortgage Process project and select New > Other.

2. Expand the Web folder, select Servlet, and then click Next.

3. In the Create Servlet dialog box, type GetForm for the name of the servlet and then click Finish.

To add an HTML page to your project:

1. From the Project Explorer window, right-click the Invoke Mortgage Process project and select New > Other.

2. Expand the Web folder, select HTML, and click Next.

3. In the New HTML dialog box, type index.html for the file name and then click Finish.

Creating Java application logic for the servlet

You create Java application logic that invokes the GetMortgageForm process from within the Java servlet. To invoke a LiveCycle ES process, such as the GetMortgageForm process, use the Invocation API. The following code shows the syntax of the GetForm Java Servlet:

public

class GetForm extends HttpServlet implements Servlet {



public

void doGet(HttpServletRequest req, HttpServletResponse resp throws

ServletException, IOException {

doPost(req,resp);

}



public

void doPost(HttpServletRequest req, HttpServletResponse resp throws

ServletException, IOException {



//Add Invocation API code here to invoke the

LiveCycle ES Process

}

Normally, you would not place client code within a Java servlet's doGet or doPost methods. A better programming practice is to place this code within a separate class, instantiate the class from within the doPost method (or doGet method), and call the appropriate methods. However, for code brevity, the code examples in this section are kept to a minimum and code examples are placed in the doPost method.

When invoking a LiveCycle ES process, you must prepare input values that are required by the process. This step is specific to the process. That is, if the process requires four input values, you must prepare four input values to pass to the process. The GetMortgageForm process requires two input parameters.

When using the Java Invocation API to invoke a process, pass required input values by using a java.util.HashMap object. For each parameter to pass, invoke the java.util.HashMap object's put method and specify the name-value pair that is required by the process. You must specify the exact name of the parameter that belongs to the process and a corresponding value. For example, if the name of the input parameter is custId and requires string value, you can create a String variable to pass to the process.

To invoke a LiveCycle ES process by using the Invocation API, perform the following tasks:

Within the Java servlet's doPost method, create a ServiceClientFactory object that contains connection properties. (See "Setting connection properties" in Programming with LiveCycle ES.)

Create a ServiceClient object by using its constructor and passing the ServiceClientFactory object. A ServiceClient object lets you invoke a service operation. It handles tasks such as locating, dispatching, and routing invocation requests

Create a java.util.HashMap object by using its constructor.

Invoke the java.util.HashMap object's put method for each input parameter to pass to the long-lived process. The GetMortgageForm process requires two string input values: a custom identifier value and the form name.

Create an InvocationRequest object by invoking the ServiceClientFactory object's createInvocationRequest method and passing the following values:

o A string value that specifies the name of the process to invoke. In this situation, specify GetMortgageForm.

o A string value that represents the name of the process operation. Typically, the name of a process operation is invoke.

o T