Skip to content

WebPublishProcedure

See Also: WebPublishFunction

Purpose

Make a procedure method available to the WebApp client.

Syntax

WebPublishProcedure
    ProcedureName

Argument Explanation

  • ProcedureName: The name of the procedure to publish.

What It Does

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

Publishing a procedure only validates that the method is allowed to be called from the client; it does not validate why the client made the call. Any published procedure that performs a conditional or protected action must re-check the condition on the server before performing that action. Do not rely on disabled controls, hidden user interface elements, JavaScript checks, or the fact that the method is normally called as a callback. Store any required state on the server, such as in a { WebProperty=Server } property, and verify it in the published procedure.

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
    Procedure MyProcedure
        // custom code
    End_Procedure
    WebPublishProcedure MyProcedure
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 WebPublishProcedure within the End_Construct_Object declaration.

For more information, see Web Properties Methods and Events.