VistA RPC

From VistApedia
Revision as of 17:04, 21 June 2007 by DavidWhitten (talk | contribs)
Jump to: navigation, search

VistA RPC is a VA developed protocol that allows for remote procedure calls against VistA. Most famously, CPRS uses the RPC mechanism as its primary communication method.

Protocol Definition

The protocol definition is found in broker msg specs.doc

Thank God.

Delphi Implemetation

CPRS is written in delphi and relies on a delphi library to make VistA RPC calls. This library is documented in RPC BROKER: Getting Started with the Broker Development Kit (BDK) which you can download from the VA.

Return types

There five different values that can be returned by a VistA RPC call.

  • Single Value : a single value is returned
  • Array : a small array of values is returned
  • Word Processing : a stream text with carriage returns is returned
  • Global Array: This type is useful for returning large amounts of data to the client, where using the ARRAY type can exceed the symbol table limit and crash your RPC.
  • Global Instance: Set the return parameter to a closed global reference.

Obviously the last two are special cases that are very specific to MUMPS.

Calling methods

In order to call an RPC, you must give it arguments or parameters which live in a "Params" object. From the manual:

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

This shows how to pass a single variable, or an array.

Then set the RPC to execute

RPCBroker1.RemoteProcedure:='A6A LIST';

Then send it...

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

You should get back the results in the Results property like so??

RPCBroker1.Results[0].Value 

not sure how multiple values are stored...


JavaLink Implementation

no idea.