Attachmate Worldwide  |   Contact Us  |   NetIQ.com
Home » Support » Solution Library

Technical Notes

Modifying MethodTimeout for an Individual Table Procedure
Technical Note 10038
Last Reviewed 04-Nov-2004
Applies To
Verastream Host Integrator version 5.0 or higher
Summary

This technical note discusses ways to modify the setMethodTimeout property of the Verastream session to increase the length of time a web application client waits for a procedure to execute.

MethodTimeout Properties

Verastream Web Builder is a component of the Verastream Host Integrator Development Kit that enables you to generate and deploy web applications, web services, and component interfaces from a Host Integrator model. The focal point of a Web Builder project is a table procedure, which abstracts legacy host navigation to resemble a database table.

A project's properties can be modified from within the Web Builder user interface (UI). The MethodTimeout property specifies how long Verastream should wait before an API method call times out. Customizations to the MethodTimeout property, or other properties, can be made either through the user interface or by modifying the JSP files generated by Web Builder. When set through the UI, the same timeout value is used for all table procedures in the project (because they share a single instance of the Session Bean).

In instances where different procedures retrieve different quantities of data, the time required for some host interactions might exceed the default method timeout (30 seconds). In this instance, you may want to edit the JavaBean properties to increase the default timeout property for only the method that requires more time, rather than increasing the default timeout for all methods.

Ways to Modify JavaBean Properties

In Java procedure-based web applications, properties used by the JavaBean are typically set during initialization, when the values are read from the bean.properties jar file.

There are three ways to modify JavaBean properties:

  • Make changes in the Web Builder user interface and rebuild your project. (As mentioned above, modifications made here apply to all table procedures.)
  • Extract and edit bean.properties, and then return it to the jar file.
  • Set JavaBean properties from the JSP file.

Of these three methods, the third is the most flexible and is used in this technical note.

Modify the JavaBean Properties from the JSP File

For each Verastream table procedure, Web Builder generates a separate JSP file. Within JSP, bean properties can be set during runtime. (Information about the names and locations of the JSP files is provided in the next section, Locate the JSP File.)

To set the MethodTimeout property globally, modify the JSP code and manually set MethodTimeout:

<jsp:useBean id="history" class="Customer.GetAcctHistory" scope="session"/>
<jsp:setProperty name="history" property="methodtimeout" value="300"/>

This code sets the MethodTimeout property for all table procedures in the project. If you want to change the property for only one table procedure, this method would require you to modify all procedure JSP files, resetting MethodTimeout to the original value (default = 30) before each procedure is executed.

To set the MethodTimeout for a single table procedure, use the following process to call JavaBean setter and getter methods before and after a procedure call. This JSP code retrieves the current MethodTimeout value, sets it to a new value, calls the procedure, and then resets MethodTimeout to its original value.

Note: In the code sample below, .getAccountHistory (in red) represents the name of your actual procedure.

<%
    int mto = history.getMethodTimeout();
    try
    {
        history.setMethodTimeout(300);
        GetAccountRecords_coll = history.getAccountHistory(filters);
    }
    catch (com.wrq.apptrieve.agent.ModelDataException e)
    {
    ...
    }
    history.setMethodTimeout(mto);
%>

Note: If you are using Verastream version 5.5 or earlier, see Known Issues in Versions 5.0 through 5.5 for additional modifications.

Locate the JSP File

Web Builder generates files for each project, and by default these files are saved to <Verastream>\projects\<MyProject>. Changes to files in the \projects\<MyProject> directory and its subdirectories are preserved and incorporated each time the project is rebuilt.

JSP files are located in the <Verastream>\projects\<MyProject>\webapps\<MyProject> directory. Two JSP files are created for each table procedure:

JSP File
Function
<procedure name>.jsp
This JSP code calls a table procedure and displays the results.
<procedure name>Form.jsp
This JSP code prompts for table procedure input parameters and calls <procedure name>.jsp.

To make changes to JavaBean properties, edit the <procedure name>.jsp file.

Web Builder deploys to the copy of Tomcat that is installed with Verastream. JSP files are deployed to the <Tomcat>\webapps\<MyProject> directory. If you are using a different Tomcat installation, you must manually redeploy the files to that instance of Tomcat.

Important: When making changes to JSP files, edit the JSP files located in the <Verastream>\projects directory, not the files located in the <Tomcat>\webapps directory. Each time Web Builder rebuilds the web application it overwrites the Tomcat files.

Regenerate the Project

Once you have edited and saved the JSP file, rebuild the project in Web Builder. When the project is rebuilt, Web Builder copies the files from \projects\<MyProject>\webapp\<MyProject> directory and all subdirectories to the <tomcat>\webapps\<MyProject> directory.

Note: When you rebuild the project in Web Builder, Web Builder will recognize that the JSP files have been updated manually. When prompted to verify changes, select "Keep your changes" and click OK.

Known Issues in Versions 5.0 through 5.5

There is a known issue in version 5.0 through 5.5 of Web Builder, which requires the setMethodTimeout() method for the Session class to be modified.

Note: Refer to Locate the JSP File for details on how and where to edit the Java code for Web Builder projects.

Each Java procedure-based Web Builder project includes a class named <MyProject>Session.jar, located in the <Verastream>\projects\<MyProject>\javabeans\src\<MyProject\ directory. This class includes all setter and getter methods used by project-related JavaBeans. Here is the existing code:

/**
* Sets the method timeout used by AppConn.
* @param methodTimeout int - The method timeout in seconds.
*/
public void setMethodTimeout( int methodTimeout ) throws ApptrieveException
{
    this.methodTimeout = methodTimeout * 1000;
    if( session != null )
        session.setMethodTimeout( methodTimeout );
}

For cases where a session object already exists and you are changing its methodTimeout value, you must make the following change (in red):

        if( session != null )
            session.setMethodTimeout( this.methodTimeout );

Related Technical Notes
40999 Verastream Host Integrator Technical Notes

Did this technical note answer your question?

Yes    No    Somewhat     Not sure yet

Additional comments about this tech note:

Need further help? For technical support, please contact Support.