Web-service_api.js

The Web-service_api.js file provides one method for each method defined by the Web service. Each method has parameters identical to those provided by the Web service, with an additional config parameter that is optional.

The OnSessionTimeout() method provided in the Web-service_api.js file enables you to specify a function to be invoked when a Web session times out. Typically, you could code a JavaScript function that asks the user to log on again. When the function is called with a null parameter, the callback is unset.

Setting an OnSessionTimeout callback when using a Web service that does not support session handling results in all return messages being sent to that callback function.

You can set the following properties for the config object.

Property Description
callback: Function This function is invoked when the Web service responds.
preprocessor: Function, or false This function is invoked before the callback function. The specified function is invoked instead of any general preprocessor set in the WSUtil.js file. Setting this value to false means that no preprocessor function is invoked. The preprocessor function itself can return true, to prevent the callback being invoked.
exceptionHandler: Function, or false This function is invoked instead of preprocessor and callback functions if the service provider returns an exception. Setting this value to false means that the exception is ignored and no handler function is called. If this value is not specified, the handler specified in the WSUtil.js file is used.
cache: Boolean If true, checks whether the value is in the local cache before invoking the Web service. If it is not in cache, it stores the value in the cache when the service responds.
cacheExpiry: Number, or false Only relevant if cache: true is set. Indicates the number of seconds the entry remains in the cache before expiring. A value of false indicates that the entry never expires. If a value is not specified, the default cache expiry setting defined in the WSUtil.js file is used. The expiry time for an item in cache is governed by the lowest value of cacheExpiry specified by the config objects of any of the calls that use it.
cacheKey: String Provides a secondary dictionary key for entries in the cache. An entry in the cache is considered a match only if the method being invoked is the same and the value of cacheKey is the same.