rpcsimp is a very basic Oracle Tuxedo ATMI application that uses TxRPC. It has one application client and one server. The client calls the remote procedure calls (operations)
to_upper() and
to_lower(), which are implemented in the server. The operation
to_upper() converts a string from lowercase to uppercase and returns it to the client, while
to_lower() converts a string from uppercase to lowercase and returns it to the client. When each procedure call returns, the client displays the string output on the user’s screen.
TUXDIR=<pathname of the Oracle Tuxedo System root directory>
TUXCONFIG=<
pathname of your present working directory>/TUXCONFIG
PATH=$PATH:$TUXDIR/bin
# SVR4, Unixware
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TUXDIR/lib
# HPUX
SHLIB_PATH=$LD_LIBRARY_PATH:$TUXDIR/lib
# RS6000
LIBPATH=$LD_LIBRARY_PATH:$TUXDIR/lib
export TUXDIR TUXCONFIG PATH LD_LIBRARY_PATH SHLIB_PATH LIBPATH
This file defines a single interface, changecase version 1.0, with two operations,
to_upper and
to_lower. Each of the operations takes a NULL-terminated character string, that is both an input and output parameter. Because no ACF file is provided, status variables are not used and the client program must be able to handle exceptions. Each operation has a void return indicating that no return value is generated.
simp.idl is used to generate the stub functions (see below).
The header, simp.h, which is generated by the IDL compiler based on
simp.idl, has the function prototypes for the two operations. The
simp.h header also includes the header files for the RPC run-time functions (none appear in this example) and exception handling. The
atmi.h header file is included because
tpterm(3c) is called. If an argument is provided on the command line, then it is used for the conversion to uppercase and lowercase (the default being “
hello world”). Exception handling is used to catch any errors. For example, exceptions are generated for unavailable servers, memory allocation failures, communication failures, and so forth. The
TRY block encapsulates the two remote procedure calls. If an error occurs, the execution will jump to the
CATCH_ALL block which converts the exception (
THIS_CATCH) into a string, prints it to the standard error output using
exc_report, and exits. Note that in both the abnormal and normal execution,
tidl(1) is called to leave the application gracefully. If this is not done, a warning is printed in the
userlog(3c) for non-Workstation clients, and resources are tied up (until the connection times out, for Workstation clients).
It also includes tx.h because
tx_open(3c) is called (as required by the X/OPEN TxRPC specification, even if no resource manager is accessed). A
tpsvrinit(3c) function is provided to ensure that
tx_open() is called once at boot time. On failure,
-1 is returned and the server fails to boot. This is done automatically, so you may not need to supply it.
The client is dependent on the simp.h header file and the client stub object file.
buildclient is executed to create the output client executable, using the
client.c source file, the client stub object file, and the
-ltrpc RPC run-time library.
The server is dependent on the simp.h header file and the server stub object file.
buildserver is an output server executable, using the
server.c source file, the server stub object file, and the
-ltrpc RPC run-time library.
*RESOURCES
IPCKEY 187345
MODEL SHM
MASTER SITE1
PERM 0660
*MACHINES
<UNAME> LMID=SITE1
TUXCONFIG="<
TUXCONFIG>"
TUXDIR="<
TUXDIR>"
APPDIR="<
APPDIR>"
# MAXWSCLIENTS=10
*GROUPS
GROUP1 LMID=SITE1 GRPNO=1
*SERVERS
server SRVGRP=GROUP1 SRVID=1
#WSL SRVGRP=GROUP1 SRVID=2 RESTART=Y GRACE=0
# CLOPT="-A -- -n <
address> -x 10 -m 1 -M 10 -d <
device>"
#
# Tuxedo-to-DCE Gateway
#simpgw SRVGRP=GROUP1 SRVID=2
*SERVICES
*ROUTING
Edit the ASCII ubbconfig configuration file to provide location-specific information (for example, your own directory pathnames and machine name), as described in the next step. The text to be replaced is enclosed in angle brackets. You need to substitute the full pathname for
TUXDIR,
TUXCONFIG, and
APPDIR, and the name of the machine on which you are running. The following is a summary of the required values.
You can monitor the RPC server using tmadmin(1). In the following example,
psr and
psc are used to view the information for the
server program. Note that the length of the RPC service name causes it to be truncated in terse mode (indicated by the “+”); verbose mode can be used to get the full name.