RPC HELP DLL GuideLines C Execute RPCs: Difference between revisions
Created page with " RPC Broker Help Home DLL Interface Home" |
No edit summary |
||
| Line 2: | Line 2: | ||
[[RPC_HELP_Other_DLL_Interface_List|DLL Interface Home]] | [[RPC_HELP_Other_DLL_Interface_List|DLL Interface Home]] | ||
<h2>C: Execute RPCs</h2> | |||
If you can make a successful connection to the RPC Broker VistA M Server, and create an application context, you can execute any RPCs registered to your context. | |||
To execute RPCs from your C program: | |||
'''1.''' Create a character buffer large enough to hold your [[RPC_HELP_RPCs|RPC]]'s return value: | |||
static char Value [1024]; | |||
'''2.''' Set the [[RPC_HELP_TRPCBroker_RemoteProcedure|RemoteProcedure]] property of the TRPCBroker component to the [[RPC_HELP_RPCs|RPC]] to execute: | |||
RPCBPropSet(RPCBroker, "RemoteProcedure","XWB GET VARIABLE VALUE"); | |||
'''3.''' Set the [[RPC_HELP_TRPCBroker_Param|Param]] values for any parameters needed by the [[RPC_HELP_RPCs|RPC]]. In the following example, one TRPCBroker [[RPC_HELP_TRPCBroker_Param|Param]] node is set (the equivalent of [[RPC_HELP_TRPCBroker_Param|Param]][0]): | |||
'''3a.''' A value of 0 for parameter 2 denotes the integer index of the [[RPC_HELP_TRPCBroker_Param|Param]] node being set ([[RPC_HELP_TRPCBroker_Param|Param]][0]). | |||
'''3b.''' A value of reference for parameter 3 denotes the setting for the equivalent of [[RPC_HELP_TRPCBroker_Param|Param]][0].[[RPC_HELP_TParamRecord_PType_Property|PType]]. This uses the enumerated values for [[RPC_HELP_TParamRecord_PType_Property|PType]] declared in the header file. | |||
'''3c.''' A value of "DUZ" for parameter 4 denotes that the equivalent of [[RPC_HELP_TRPCBroker_Param|Param]][0].[[RPC_HELP_TParamRecord_Value_Property|Value]] is "DUZ": | |||
RPCBParamSet(RPCBroker, 0, reference, "DUZ"); | |||
'''4.''' Use the RPCBCall method to execute the [[RPC_HELP_RPCs|RPC]]: | |||
RPCBCall(RPCBroker, Value); | |||
The return value from the RPC is returned in the second parameter (in this case, the Value character buffer). | |||
Latest revision as of 16:21, 8 July 2015
C: Execute RPCs
If you can make a successful connection to the RPC Broker VistA M Server, and create an application context, you can execute any RPCs registered to your context.
To execute RPCs from your C program:
1. Create a character buffer large enough to hold your RPC's return value:
static char Value [1024];
2. Set the RemoteProcedure property of the TRPCBroker component to the RPC to execute:
RPCBPropSet(RPCBroker, "RemoteProcedure","XWB GET VARIABLE VALUE");
3. Set the Param values for any parameters needed by the RPC. In the following example, one TRPCBroker Param node is set (the equivalent of Param[0]):
3a. A value of 0 for parameter 2 denotes the integer index of the Param node being set (Param[0]).
3b. A value of reference for parameter 3 denotes the setting for the equivalent of Param[0].PType. This uses the enumerated values for PType declared in the header file.
3c. A value of "DUZ" for parameter 4 denotes that the equivalent of Param[0].Value is "DUZ":
RPCBParamSet(RPCBroker, 0, reference, "DUZ");
4. Use the RPCBCall method to execute the RPC:
RPCBCall(RPCBroker, Value);
The return value from the RPC is returned in the second parameter (in this case, the Value character buffer).