RPC HELP Executing RPC How to

RPC Broker Help Home How to Execute an RPC from a Client 1. If your RPC has any input parameters beyond the mandatory first parameter, set a Param node in the TRPCBroker's Param property for each. For each input parameter, set the following subproperties:
 * Value
 * PType (literal, list, or reference).

If the parameter's PType is list, however, instead of specifying a value, instead set a list of values in the Mult property.

Here is an example of some settings of the Param property:

brkrRPCBroker1.Param[0].Value := '10/31/97'; brkrRPCBroker1.Param[0].PType := literal; brkrRPCBroker1.Param[1].Mult['"NAME"'] := 'SMITH, JOHN'; brkrRPCBroker1.Param[1].Mult['"SSN"'] := '123-45-6789'; brkrRPCBroker1.Param[1].PType := list;

2. Set the TRPCBroker's RemoteProcedure property to the name of the RPC to execute.

brkrRPCBroker1.RemoteProcedure:='A6A LIST';

3. Invoke the Call method of the TRPCBroker component to execute the RPC. All calls to the Call method should be done within an exception handler try...except statement, so that all communication errors (which trigger the EBrokerError exception) can be trapped and handled. For example:

try brkrRPCBroker1.Call; except On EBrokerError do ShowMessage('A problem was encountered communicating with the server.'); end;

4. Any results returned by your RPC are returned in the TRPCBroker component's Results property. Depending on how you set up your RPC, results are returned either in a single node of the Results property (Results[0]), or in multiple nodes of the Results property. NOTE: You can also use the lstCall and strCall methods to execute an RPC. The main difference between these methods and the Call method is that lstCall and strCalll do not use the Results property, instead returning results into a location you specify.