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

From VistApedia
Jump to: navigation, search
(Created page with " RPC Broker Help Home <h2>How to Execute an RPC from a Client</h2> '''1.''' If your RPC has any input parameters beyond the mandatory first parameter, set ...")
 
Line 1: Line 1:
 
[[RPC_Broker_Help| RPC Broker Help Home]]
 
[[RPC_Broker_Help| RPC Broker Help Home]]
 
<h2>How to Execute an RPC from a Client</h2>
 
<h2>How to Execute an RPC from a Client</h2>
'''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:
+
'''1.''' If your RPC has any input parameters beyond the mandatory first parameter, set a [[RPC_HELP_TRPCBroker_Param|Param]] node in the [[RPC_HELP_TRPCBroker|TRPCBroker]]'s [[RPC_HELP_TRPCBroker_Param|Param]] property for each. For each input parameter, set the following subproperties:
* Value
+
* [[RPC_HELP_TParamRecord_Value_Property|Value]]
* PType (literal, list, or reference).
+
* [[RPC_HELP_TParamRecord_PType_Property|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.
+
If the parameter's [[RPC_HELP_TParamRecord_PType_Property|PType]] is list, however, instead of specifying a value, instead set a list of values in the [[RPC_HELP_TParamRecord_Mult_Property|Mult]] property.
  
Here is an example of some settings of the Param property:
+
Here is an example of some settings of the [[RPC_HELP_TRPCBroker_Param|Param]] property:
  
 
     brkrRPCBroker1.Param[0].Value := '10/31/97';
 
     brkrRPCBroker1.Param[0].Value := '10/31/97';
Line 15: Line 15:
 
     brkrRPCBroker1.Param[1].PType := list;
 
     brkrRPCBroker1.Param[1].PType := list;
  
'''2.''' Set the TRPCBroker's RemoteProcedure property to the name of the RPC to execute.
+
'''2.''' Set the [[RPC_HELP_TRPCBroker|TRPCBroker]]'s RemoteProcedure property to the name of the RPC to execute.
  
 
     brkrRPCBroker1.RemoteProcedure:='A6A LIST';
 
     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:
+
'''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:
  
 
     '''try'''
 
     '''try'''
Line 28: Line 28:
 
     '''end;'''
 
     '''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.
+
'''4.''' Any results returned by your RPC are returned in the [[RPC_HELP_TRPCBroker|TRPCBroker]] component's [[RPC_HELP_TRPCBroker_Results|Results]] property. Depending on how you set up your RPC, results are returned either in a single node of the [[RPC_HELP_TRPCBroker_Results|Results]] property (Results[0]), or in multiple nodes of the [[RPC_HELP_TRPCBroker_Results|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 strCall do not use the Results property, instead returning results into a location you specify.
+
NOTE: You can also use the [[RPC_HELP_TRPCBroker_lstCall_Method|lstCall]] and [[RPC_HELP_TRPCBroker_strCall_Method|strCall]] methods to execute an RPC. The main difference between these methods and the [[RPC_HELP_TRPCBroker_Call_Method|Call]] method is that [[RPC_HELP_TRPCBroker_lstCall_Method|lstCall]] and [[RPC_HELP_TRPCBroker_strCall_Method|strCall]]l do not use the [[RPC_HELP_TRPCBroker_Results|Results]] property, instead returning results into a location you specify.

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.