API for Providing an RPC Context from the Natural Client Side

#### Search Results

Search

# API for Providing an RPC Context from the Natural Client Side

This document presents the API RPC-CNTX to provide an RPC context from the Natural client side.

- RPC-CNTX

## RPC-CNTX

The API RPC-CNTX can be used for providing a context for RPC calls as it is done in test programs generated by the webMethods EntireX Natural Wrapper.

RPC-CNTX combines the functionality of several APIs and is available in library `SYSTEM`. There is no need for extra preparations such as setting a STEPLIB or to copy APIs from SYSEXT to user libraries.

To make use of RPC-CNTX

1. Specify a `DEFINE DATA` statement

   where level `01` is defined by `01 RPC-CNTX-AREA`, and specify the following parameters on level `02`:

   Parameter | Format | I/O | Description
   --- | --- | --- | ---
   FUNCTION | A2 | I |
   `'SL'` | Set the RPC context depending on the parameters given and log on to EntireX Broker.
   `'SC'` | Set the RPC context depending on the parameters given.
   `'GC'` | Get RPC context. By default, the required information relates to the default server.
   `'LO'` | Log on to EntireX Broker
   `'LF'` | Log off from EntireX Broker
   BROKERID | A dynamic | I/O | Specify the broker name. See the profile parameter `SRVNODE`.
   CLASS | A32 | I | Specify the server class. For Natural RPC servers, this is `RPC`. See the keyword subparameter SRVNAME of the RPC profile parameter.
   SERVER | A32 | I/O | Specify the server name. See the profile parameter `SRVNAME`
   SERVICE | A32 | I | Specify the type of RPC. For Natural RPC servers, this is `CALLNAT`.
   COMPRESSLEVEL | A1 | I/O | Compression level requires API version 7.
   RESERVED | I1 | I/O | Reserved for future use.
   RPC-LIBRARY | A08 | I |
   RPC-RELIABLE-STATE | N1 | I/O |
   `0` | No reliable RPC (standard RPC execution)
   `1` | Reliable RPC (`AUTO_COMMIT`)
   `2` | Reliable RPC (`Client_COMMIT`)
   NAT-LOGON | A11 | I/O |
   EXX-USERID | A32 | I |
   EXX-PASSWORD | A32 | I |
   RPC-USERID | A32 | I |
   RPC-PASSWORD | A32 | I |
   ERR-CODE | I4 | O | The origin of some error code can be detected by the following identifiers:
   USR1071N,(USR4371N) | 1nnnn
   USR6304N | 2nnnn
   USR2007N | 3nnnn
   USR4008N | 5nnnn
   USR4009N | 8nnnn
   USR2071N | 9nnnn
   ERR-TEXT | A dynamic | O |

   Note
   The most important function codes are `'SL'` and `'LF'`. Function code `'SL'` is a combination of setting the RPC context (`'SC'`) and a logon to EntireX Broker `('LO')`.

2. In the calling program on the client side, specify the following statement:

       CALLNAT 'RPC-CNTX' RPC-CNTX-AREA

   For further information refer to Syntax Description in CALLNAT in the Statements documentation.

The setting of the RPC context is processed as follows:

1. Set the credentials for RPC server by specifying `RPC-USERID` and `RPC-PASSWORD` (API USR1071N).

2. Set the mode for reliable RPC by specifying `RPC-RELIABLE-STATE` (API USR6304N).

3. Set the data for the RPC default server including the logon option with a specification for `BROKERID`, `SERVER` and `NAT-LOGON` (API USR2007N).

4. Change the library name on the RPC server for the logon by specifying `RPC-LIBRARY` (API USR4008N). If the name is left blank, the API is not called.

5. Set parameters for EntireX `COMPRESSLEVEL` by using API USR4009N. If no values are specified, the API is not called.

6. For logging on to the EntireX Broker, specify `BROKERID`, `EXX-USERID`, and `EXX-PASSWORD`, which are then passed to USR2071N.

After you have finished your work with the RPC connection, you need to log off from the EntireX Broker using RPC-CNTX with function code `'LF'`.