Difference between revisions of "RPC HELP Tutorial Step 11"

From VistApedia
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[RPC_Broker_Help| RPC Broker Help Home]]
 
[[RPC_Broker_Help| RPC Broker Help Home]]
 +
 
[[RPC_Broker_Help#Tutorial|Tutorial Home]]
 
[[RPC_Broker_Help#Tutorial|Tutorial Home]]
 
<h2>Tutorial: Register RPCs</h2>
 
<h2>Tutorial: Register RPCs</h2>
Line 8: Line 9:
 
To register the RPCs used by the tutorial application:
 
To register the RPCs used by the tutorial application:
  
'''1.''' Create an option of type "B" (Broker). For example, create an option called ZxxxTT TERMTYPE for the tutorial application.
+
'''1.''' Create an [[RPC_HELP_OPTION_ENTRY|OPTION]] of type "B" (Broker). For example, create an [[RPC_HELP_OPTION_ENTRY|OPTION]]  called ZxxxTT TERMTYPE for the tutorial application.
 +
* In the "B"-type  [[RPC_HELP_OPTION_ENTRY|option]] 's RPC multiple, make one entry for each RPC your application calls. In the case of this tutorial, there should be two entries: one for ZxxxTT LIST and one for ZxxxTT RETRIEVE.
 +
* Follow the steps in [[RPC_HELP_Executing_RPC_Security_Register|How to Register an RPC]] to create an application context, using the ZxxxTT TERMTYPE option. 
 +
* Below is an example record of such an entry in the OPTION file (#19)
  
'''2.''' In the "B"-type option's RPC multiple, make one entry for each RPC your application calls. In the case of this tutorial, there should be two entries: one for ZxxxTT LIST and one for ZxxxTT RETRIEVE.
+
    Record# 11433, in FILE: 19
 +
      .01-NAME : '''ZxxxTT TERMTYPE'''
 +
        1-MENU TEXT : RPC Tutorial Context Entry
 +
      1.1-UPPERCASE MENU TEXT : RPC TUTORIAL CONTEXT ENTRY
 +
      3.6-CREATOR : TOPPENBERG,KEVIN S (`168 in #200)
 +
        4-TYPE : '''Broker (Client/Server)'''
 +
      320-RPC :
 +
          Multiple Entry #1
 +
          .01-RPC : '''ZxxxTT LIST''' (`2811 in #8994)
 +
   
 +
          Multiple Entry #2
 +
          .01-RPC : '''ZxxxTT RETRIEVE''' (`2812 in #8994)
  
'''3.''' Follow the steps in How to Register an RPC to create an application context, using the ZxxxTT TERMTYPE option. Essentially, add a line of code that calls the CreateContext function, and terminates the application if False is returned. The code for Form1's OnCreate event should now look like:
+
'''2.''' Add a line of code that calls the [[RPC_HELP_TRPCBroker_CreateContext_Method|CreateContext]]  function, and terminates the application if False is returned. The code for Form1's OnCreate event should now look like:
  
 
     '''procedure''' TForm1.FormCreate(Sender: TObject);
 
     '''procedure''' TForm1.FormCreate(Sender: TObject);
Line 42: Line 57:
 
     '''end;'''
 
     '''end;'''
  
'''4.''' Compile and run your application. Try running it both with and without the [[RPC_HELP_XUPROGMODE|XUPROGMODE]] security key assigned to you. Without [[RPC_HELP_XUPROGMODE|XUPROGMODE]], you won't be able to run your application unless the ZxxxTT TERMTYPE option is assigned to your menu tree.
+
'''3.''' Compile and run your application. Try running it both with and without the [[RPC_HELP_XUPROGMODE|XUPROGMODE]] security key assigned to you. Without [[RPC_HELP_XUPROGMODE|XUPROGMODE]], you won't be able to run your application unless the ZxxxTT TERMTYPE option is assigned to your menu tree.
 +
 
 +
<h4>[[RPC_HELP_Tutorial_Step_10|PREV: Step 10: Call ZxxxRETRIEVE RPC]]</h4>
 +
<h4>[[RPC_HELP_Tutorial_See_Also|NEXT: See Also: FileMan Delphi Components (FMDC)]]</h4>

Latest revision as of 13:25, 17 July 2015

RPC Broker Help Home

Tutorial Home

Tutorial: Register RPCs

Up until now, it has been assumed that the only user of your application is you, and that you have programmer access and the XUPROGMODE key in the account where your RPCs are accessed.

Under any other circumstance, any RPCs that your application uses must be registered for use by your application on the host system. Registration authorizes the RPC(s) for use by your client based on user privileges.

To register the RPCs used by the tutorial application:

1. Create an OPTION of type "B" (Broker). For example, create an OPTION called ZxxxTT TERMTYPE for the tutorial application.

  • In the "B"-type option 's RPC multiple, make one entry for each RPC your application calls. In the case of this tutorial, there should be two entries: one for ZxxxTT LIST and one for ZxxxTT RETRIEVE.
  • Follow the steps in How to Register an RPC to create an application context, using the ZxxxTT TERMTYPE option.
  • Below is an example record of such an entry in the OPTION file (#19)
   Record# 11433, in FILE: 19
      .01-NAME : ZxxxTT TERMTYPE
        1-MENU TEXT : RPC Tutorial Context Entry
      1.1-UPPERCASE MENU TEXT : RPC TUTORIAL CONTEXT ENTRY
      3.6-CREATOR : TOPPENBERG,KEVIN S (`168 in #200)
        4-TYPE : Broker (Client/Server)
      320-RPC :
          Multiple Entry #1
          .01-RPC : ZxxxTT LIST (`2811 in #8994)
   
          Multiple Entry #2
         .01-RPC : ZxxxTT RETRIEVE (`2812 in #8994)

2. Add a line of code that calls the CreateContext function, and terminates the application if False is returned. The code for Form1's OnCreate event should now look like:

   procedure TForm1.FormCreate(Sender: TObject);
   var 
     ServerStr: String;
     PortStr: String;
   begin
     TermTypeList:=TStringList.Create;
     // Get the correct port and server from Registry.
     if GetServerInfo(ServerStr,PortStr)<> mrCancel then begin  {connectOK begin}    
       brkrRPCBroker1.Server:=ServerStr;
       brkrRPCBroker1.ListenerPort:=StrToInt(PortStr);
       // Establish a connection to the RPC Broker server.
       try
         brkrRPCBroker1.Connected:=True;
         // Check security.
         if not brkrRPCBroker1.CreateContext('ZxxxTT TERMTYPE') then
           Application.Terminate;
       except
         On EBrokerError do begin  {error begin}          
           ShowMessage('Connection to server could not be established!');
           Application.Terminate;          
         end;  {error end}        
       end;  {try end}        
     end {connectOK end}
     else begin
       Application.Terminate;
     end;
   end;

3. Compile and run your application. Try running it both with and without the XUPROGMODE security key assigned to you. Without XUPROGMODE, you won't be able to run your application unless the ZxxxTT TERMTYPE option is assigned to your menu tree.

PREV: Step 10: Call ZxxxRETRIEVE RPC

NEXT: See Also: FileMan Delphi Components (FMDC)