RPC HELP TRPCBroker RPCVersion Example
From VistApedia
RPCVersion Example
In the following example, an RPC is first called with two parameters that will be added together and the sum returned to the client. Again, this same RPC is called with the same parameters, however, this time it uses a different RPC version value. Thus, the two numbers are simply concatenated together and the resulting string is returned:
On the client:
procedure TForm1.Button1Click(Sender: TObject); begin {make sure the results get cleared} brkrRPCBroker1.ClearResults := True; {just re-use the same parameters} brkrRPCBroker1.ClearParameters := False; brkrRPCBroker1.RemoteProcedure := 'MY APPLICATION REMOTE PROCEDURE'; brkrRPCBroker1.Param[0].Value := '333'; brkrRPCBroker1.Param[0].PType := literal; brkrRPCBroker1.Param[1].Value := '444'; brkrRPCBroker1.Param[1].PType := literal; brkrRPCBroker1.Call; {the result will be 777} Label1.Caption := 'Result of the call: ' + brkrRPCBroker1.Results[0]; brkrRPCBroker1.RPCVersion := '2'; brkrRPCBroker1.Call; {the result will be 333444} Label2.Caption := 'Result of the call: ' + brkrRPCBroker1.Results[0]; end;
On the server:
TAG(RESULT,PARAM1,PARAM2) ;Code for MY APPLICATION REMOTE PROCEDURE IF XWBAPVER<2 SET RESULT=PARAM1+PARAM2 ELSE SET RESULT=PARAM1_PARAM2 QUIT RESULT