Difference between revisions of "RPC HELP Executing RPC How to"

From VistApedia
Jump to: navigation, search
 
Line 19: Line 19:
 
     brkrRPCBroker1.RemoteProcedure:='A6A LIST';
 
     brkrRPCBroker1.RemoteProcedure:='A6A LIST';
  
'''3.''' Invoke the [[RPC_HELP_TRPCBroker_Call_Method|Call]] method of the [[RPC_HELP_TRPCBroker|TRPCBroker]] component to execute the RPC. All calls to the [[RPC_HELP_TRPCBroker_Call_Method|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:
+
'''3.''' Invoke the [[RPC_HELP_TRPCBroker_Call_Method|Call]] method of the [[RPC_HELP_TRPCBroker|TRPCBroker]] component to execute the RPC. All calls to the [[RPC_HELP_TRPCBroker_Call_Method|Call]] method should be done within an exception handler '''try...except''' statement, so that all communication errors (which trigger the [[RPC_HELP_TRPCB_EBrokerError|EBrokerError]] exception) can be trapped and handled. For example:
  
 
     '''try'''
 
     '''try'''

Latest revision as of 11:45, 6 July 2015

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:

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.