Use JiGlue COM Bridge in ASP

This sample demonstrates how to use the JiGlue COM Bridge to access queue information in an ASP-based application. The primary advantage of creating an ASP-based solution for working with the JiGlue COM Bridge is that the JiGlue COM Bridge need not be registered and deployed on each client system. In contrast, if you develop a Visual Basic application, you must configure and register the JiGlue COM Bridge on the client system the application can communicate with WorkFlo Services.

This topic includes:

Creating a Sample VWSession object (using JiGlue) to Query Queues

The sample creates a VWSession object and uses that object to query queues for information.

<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<title>List Queues using the JiGlue COM Bridge</title>
<body>
<%

'Dimension the necessary variables. In this example, the web_server_name
'and router_name variables are assigned explicit, literal values.
'An alternate method might be to pass the information in from another page using
'the Request.QueryString(), which is part of the VB Object Model.
'Refer to the appropriate Microsoft documentation for more information.

Dim web_server_name, router_name, objJiGlue, session
Dim queues, description
web_server_name = "asgard"
router_name = "vwrouter"

'Create an instance of JiGlue, and use it to create a VWSession object.

set objJiGlue = CreateObject("JiGlue.Util")
set session = objJiGlue.newInstance("filenet.vw.api.VWSession")

'Call the logon() method on the newly created session object.
'The sample statement shown here passes SysAdmin as both the username and
'password and constructs the RMI statement using the
'values specified for the web_server_name and router_name variables.

session.logon "SysAdmin","SysAdmin","rmi://" & web_server_name & "/" & router_name
%>

<!-- Start a table list the queues that are available on the system. -->

<table border="0" width="80%" bgcolor="#EEEEEE">
<tr><td colspan="2" bgcolor="#CCFFCC"><strong>Available Queues</strong></td></tr>
<tr><td bgcolor="#CCFFCC"><strong>Name</strong></td>
<td bgcolor="#CCFFCC"><strong>Type</strong></td></tr>
<%

'Retrieve an array of queue names using the newly-created session object. This example
'passes an integer value of 23 to retrieve all user, process (or work), and
'system queues. The integer value is the result of a logical OR of the values associated
'with each queue type. Refer to the VWSession.fetchQueueNames() method description,
'in the eProcess API reference documentation, for more information.

Dim queueValue
queues = session.fetchQueueNames(23)
for i=0 to UBound(queues)

'Using the array of queue names, retrieve the VWQueue object for
'each queue name found. Query the VWQueue object to determine the queue type.

set objQueue = session.getQueue(CStr(queues(i)))
queueValue = objQueue.getQueueType
%>

<!-- Start a row, and create a cell with the current queue name. -->

<tr><td width="33%">
<%=queues(i)%>
</td>

<!-- Create a cell with the containing the description of the queue type based on the integer value returned from the getQueueType() method. -->

<td width="66%">
<%

'Convert the retrieved value to a human readable description of the queue type.

if queueValue = 1 then
description = "Work"
elseif queueValue = 2 then
description = "User"
else
description = "System"
end if
%>
<%=description%>
</td></tr>
<%
Next
%>

<!-- Close the table once all queues have been retrieved. -->

</table>
<%

'Call the logoff() method on the VWSession object to end the session and log off.

session.logoff
%>

<P>This sample HTML and VBScript code demonstrates one way of creating a VWSession object, logging on to the server, retrieving a list of available queues, displaying the retrieved queue information, and logging off the server.</P>
</body>
</html>

Running the Sample ASP

You can run this sample by copying the contents of the code block (above) to an empty file called queue.asp. Place the queue.asp file in the <drive>...\Program Files\FileNET\IDM\Web\IDMWS directory on your Web WorkFlo server, and enter the address for the explicit page.

For example, if the Web WorkFlo server is named Asgard, you would enter an address in a web browser similar to the following:

http://asgard/idmws/queue.asp

For the code shown above to work you must have the following:

Tip Another method of establishing a WorkFlo session for an .ASP based application is by using the global.asa file to set application-scoped variables and objects (like the web server name or the router name). The application-scoped variable approach allows you to develop event handlers that run automatically when special ASP events occur and instantiate well-known IDM objects.