Building Distributed
Applications
Using the Progress AppServer


Calling the EXPORT( ) Method

There is no requirement to execute the EXPORT( ) method within an AppServer session. If the EXPORT( ) method is not called, or the export list is at any point reset to empty, then all remote procedure requests are accepted for execution.

Setting an Initial Export List

The following code example shows how you might invoke the EXPORT( ) method from within an AppServer Connect procedure. In this example, two procedures, order.p and stock.p, are added to the export list.

DEFINE INPUT PARAMETER user-id AS CHARACTER.
DEFINE INPUT PARAMETER password AS CHARACTER.
DEFINE INPUT PARAMETER app_server_info AS CHARACTER.

DEFINE VARIABLE ret AS LOGICAL.

/* authenticate user and call EXPORT appropriately for this user. */
.
.
.

ASSIGN ret = SESSION:EXPORT("order.p,stock.p"). 

When this code executes, it adds the two procedures to the export list. A remote procedure request to an Application Server process that executes this AppServer Connect procedure executes itself only if the request is for order.p or stock.p. Otherwise, the remote procedure request returns an error.

Export list entries can also include names with an asterisk (*). The asterisk is a wildcard character to indicate that any group of characters is acceptable as a replacement for the asterisk.

For example, you can reference all procedures in a directory such as stocksys/*.p, some procedures in a directory such as acctpay/qry*.p, or all procedures in a library such as order.pl<<*>>.

ret = SESSION:EXPORT("stocksys/*.p,acctpay/qry*.p,orders.pl<<*>>"). 

After this code executes, all procedures located in the stocksys directory, some procedures located in the acctpay directory, and all procedures located in the orders procedure library are added to the export list.

If you create an export list, keep in mind that a client application is unaware that the procedures that it is submitting are being validated against this list. When the Application Server process rejects a procedure for not being on this list, it returns an error to the client application.

Resetting the Export List

At any time while servicing a connection, you can modify any existing export list by adding to the list or resetting the list. Thus, for example, if the list contains "order.p,stock.p", you can add "payment.p":

ret = SESSION:EXPORT("payment.p"). 

This, then, expands the list to "order.p,stock.p,payment.p".

If at any point, you want to completely reset the list, you can do this:

ret = SESSION:EXPORT(). /* Reset to empty */
ret = SESSION:EXPORT("special-order.p,special-stock.p"). 

At this point, the Application Server process only accepts remote procedure calls to special-order.p and special-stock.p.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095