Active Server Pages (ASP) Process Scripting Overview

Process applications using the FileNet Web Services web application and PJAC for FileNet Web Services for integration and connectivity to the Process Engine normally use server-side "Active Server Pages" (ASPs) to host the application. When developing a Process application ASP, you may use any script language supported by the Microsoft Script Host (FileNet Web Services and PJAC for FileNet Web Services files use VBScript for all server-side scripting and JavaScript for all ActiveX client-side scripting).

You may script your own ASPs for a Step Processor, Personal Work Manager, or other Process application, or you can simplify the task by using the ASPs and other resources provided with the FileNet Web Services HTML Step Processor Toolkit. For additional information on scripting an ASP for a Process application, with a particular focus on how to use the HTML Step Processor Tookit to customize the default HTML Step Processor and/or Launch Step Processor applications provided with the Toolkit, see Using the FileNet Web Services HTML Step Processor Toolkit.

Subtopics on scripting ASPs include:

Server-side Scripting Overview

Server-side scripts run when a browser requests an ASP file from the web server. The server processes the ASP file from top to bottom and executes the script commands in the sequence they appear in the page. Because the scripts run on the server, the web server performs all of the necessary processing and returns the requested data to the client browser in an HTML page minus the server-side scripting code.

For hosting a Process application, there are a number of benefits to server-side scripting:

As indicated, you can include a client-side script in the same ASP page. The server-side script executes before the server returns a response, but the client-side script is sent as part of the response; i.e., the client-side script is ignored by the ASP interpreter and is passed to the client as though it were a normal HTML page. For example:

<HTML>
<BODY>
This is text and HTML that will not be executed and is passed
to the client.
<SCRIPT RUNAT="SERVER">
  'This is a server-side script that will be interpreted 
  'and executed by ASP.
</SCRIPT>
<SCRIPT>
<!-- 'This is a client-side script that will be executed by 
     'the client browser. Note that the RUNAT="CLIENT" attribute 
     'is optional. -->
</SCRIPT>
</BODY>
</HTML>

Additionally, you can include other pages in your ASP. These included files are treated as part of the ASP file during execution. The included files are executed from beginning to end before returning to the ASP that called the file. Any statements placed between the <%. . .%> delimiters are treated as script statements.

Within the ASP, you can develop a web-based Process application that accesses IDM Foundation objects for document functionality (through the JavaScript API objects: IDMWSC_Document, IDMWSC_Folder, IDMWSC_Library, and IDMWSC_StoredSearch) and/or Process Engine services for workflow functionality (via the JiGlue COM bridge and the Process Java APIs). To provide workflow functionality, you use a scripting language (like VBScript or JavaScript) in an ASP file to log on to the Process Engine and create a Process session, query user and work queues, retrieve and update information, etc. from a Process Engine server. Your script will typically include HTML tags, such as Form tags, to enable the user to interact via the browser and also script commands that provide logic for communication with the Process Engine. As indicated above, since scripting embedded in an ASP file runs on the server, only the HTML content (which may include a client-side script) is returned to the client browser.

ASP Objects Used for Process

The following objects in the Active Server Page Object Model may be used for Process applications: Server, Application, Session, Request, and Response. The Server object is actually the operating environment for the Active Server Pages. Note that since the FileNet Web Services and Process Services architecture does not rely on MTS transactions, you should not attempt to use the ObjectContext object.

For more information on the Active Server Page Object Model objects, their methods and properties, and how to use them, refer to the Microsoft MSDN documentation.

Example ASP with Looping a Variable

This example illustrates the structure of a simple ASP file, what the client's browser might display, and shows the source received by the client for the request.

Assume that an ASP file contains the following content:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<TITLE>Sample ASP Page showing a loop</TITLE>
</HEAD>
<BODY>
<H1>Looping a variable</H1>

<%
' Before sending the response back to the client, loop
' through a count 5 times and use a Response.Write
' statement to print the current loop count in the HTML document.

Dim loopNum, loopString

' Dimension two variables; one for holding an integer and one
' for holding the dynamically updated, HTML formatted string.

For loopNum = 1 to 5
  loopString = "<font color='#0000FF'>The current loopNum count equals: " & loopNum & "</font><BR>"
Response.Write(loopString)
Next
%>

<P>This paragraph is static HTML content.</P>

<SCRIPT Language="JavaScript">
/* This is an example of client-side code executed on the client. */
document.write("Today's date is " + Date());
</SCRIPT>
</BODY>
</HTML>

When a client requests the ASP file containing the source shown above, the user sees content similar (the formatting might be different) to the following in the client browser:

Looping a variable

The current loopNum count equals: 1
The current loopNum count equals: 2
The current loopNum count equals: 3
The current loopNum count equals: 4
The current loopNum count equals: 5

This paragraph is static HTML content.

Today's date is Fri Sep 12 06:00:00 2036

If the user views the source, delivered as a response to the initial ASP request, he or she would see the following HTML-formatted code:

<HTML>
<HEAD>
<TITLE>Sample ASP Page showing a loop</TITLE>
</HEAD>
<BODY>
<H1>Looping a variable</H1>
<font color='#0000FF'>The current loopNum count equals: 1</font><BR>
<font color='#0000FF'>The current loopNum count equals: 2</font><BR>
<font color='#0000FF'>The current loopNum count equals: 3</font><BR>
<font color='#0000FF'>The current loopNum count equals: 4</font><BR>
<font color='#0000FF'>The current loopNum count equals: 5</font><BR>
<P>This paragraph is static HTML content.</P>
SCRIPT Language="JavaScript">
/* This is an example of client-side code executed on the client. */
document.write("Today's date is " + Date());
</SCRIPT>
</BODY>
</HTML>

Note While the JavaScript source included in the original ASP file was included in the response sent to the client browse, none of the server-side VBScript statements were included.