Skip to content

WebPublishFunction

See Also: WebPublishFunction

Purpose

Make a function method available to the WebApp client.

Syntax

WebPublishFunction FunctionName

Argument Explanation

  • FunctionName: The name of the function to publish.

What It Does

WebPublishFunction makes a procedure available to be called from the WebApp client.

The WebPublish interface forms part of your web application’s security against unauthorized access. When a call is received from a client (browser), the name of the procedure or function that is called is checked against the target object’s list of published methods. Web-publishing a procedure means you are declaring that it is safe to call that method from the client; otherwise, the call is rejected and an error is raised.

Only the cWebObject class (or its subclasses) support the WebPublish interface.

Object oMyObject is a cWebObject
    Function MyFunction returns (someDataType)
        // custom code
    End_Function

    WebPublishFunction MyFunction
End_Object

This example shows how a procedure is declared in a web object and published so that it can be called from the WebApp client using the serverAction interface (see Building Custom Controls for more information).

If you are web-publishing a procedure within a class declaration, then you should place WebPublishFunction within the End_Construct_Object declaration.

For more information, see Web Properties Methods and Events.

Subclassing

Only subclasses of the cWebObject class understand the interface for publishing a web method.

When used in subclasses, WebPublishFunction must be called from inside Construct_Object or End_Construct_Object.