Using the JSM for Remote Procedure Calls between iSeries Systems
Example 219 - Rating: advanced
This example provides a generic framework that you may use to perform Remote Procedure Calls (RPCs) between LANSA RDML functions executing on different iSeries systems.
Arguments may be passed to the called functions and values returned by them:
The remote procedure calls cross the Internet using XML formatted data transferred using the HTTP protocol.
The major SET components in this example are RDML functions SET219Y and SET219Z:
SET219Y and SET219Z provide a generic framework for performing RPCs.
To call an RDML function on a remote iSeries system you call function SET219Y, telling it:
SET219Y then converts the returned XML data back into arguments and returns control back to your function.
This example also provides a number of specific examples of how to use the SET219Y/Z generic framework to perform remote procedure calls:
SET219A and B demonstrate the essentials of how arguments are passed to and returned by remote procedures.
They do this by performing simple numeric numerical calculations and string manipulations:
SET219C and D demonstrate how you might pass data base information between functions.
They do this by providing a simple employee details and skills enquiry that uses the shipped LANSA demonstration system:
SET219E and F demonstrate how you might pass lists in SET219Y/Z framework.
They use the shipped LANSA demonstration system to demonstrate how a list of employees may be passed between functions:
SET219G and H demonstrate how messages are passed by the SET219Y/Z framework.
They do this by allowing OS/400 commands to be executed on the remote host system.
For more detailed information about how the SET219Y/Z framework may be used refer to the shipped source code of the specific SET219A/B, SET219C/D, SET219E/F or SET219G/H examples.
Detailed Notes and Suggestions
These examples allow the special value local to be specified as the host URL.
When the special value local is used the entire remote procedure call process is short circuited and the called functions are directly invoked. The JSM is not required to execute in this mode and no XML is used. The local facility demonstrates the flexibility of the SET219Y/Z generic framework in that local procedure calls may proceed at optimal speed. For SET219Y/Z framework user applications (eg: SET219A and SET219B) the local facility is both functionally identical to a remote procedure call and completely transparent.
The parameter and list passing facilities that the SET219Y/Z generic framework provides are based on a simple symbolic name / value system. In essence, a list of named values is exchanged between the application on the client and the application on the remote host.
The SET219A/B, SET219C/D, SET219E/F and SET219G/H examples interface to the named value list by using these simple subroutines:
If you look at the source code of one of the example functions (eg: SET219C) you will see executions of these subroutines that are structured like this:
where:
Here are some simple examples of using these interfaces:
This example sets the current value of field #EMPNO into the list with name EMPNO as instance number 1:
Execute Subroutine(SET_ALPHA) With_Parms(EMPNO *BLANKS 1 #EMPNO)
This example sets the current value of field #REQEMPNO into the list with name EMPNO as instance number 1.
Execute Subroutine(SET_ALPHA) With_Parms(EMPNO *BLANKS 1 #REQEMPNO)
This example creates a symbolic list named EMPLIST of employee numbers, names and post/zip codes by using both symbolic names 1 and 2 and a variable instance number. It also creates a single simple name EMPCOUNT that indicates how many entries were placed in the list:
Select Fields(#EMPNO #SURNAME #GIVENAME #POSTCODE) From_File(PSLMST2) With_Key(#SURNAME) Generic(*Yes)
Change Field(#LISTCOUNT) To('#LISTCOUNT + 1')
Execute Subroutine(SET_ALPHA) With_Parms(EMPLIST EMPNO #LISTCOUNT #EMPNO)
Execute Subroutine(SET_ALPHA) With_Parms(EMPLIST SURNAME #LISTCOUNT #SURNAME)
Execute Subroutine(SET_NUMBER) With_Parms(EMPLIST POSTCODE #LISTCOUNT #POSTCODE)
Endselect
Execute Subroutine(SET_NUMBER) With_Parms(EMPCOUNT *BLANKS 1 #LISTCOUNT)
This example retrieves the symbolic list named EMPLIST created in the previous example and copies it into a browse list named #EMPLIST:
Def_List Name(#EMPLIST) Fields(#EMPNO #SURNAME #POSTCODE)
Clr_List Named(#EMPLIST)
Execute Subroutine(GET_NUMBER) With_Parms(EMPCOUNT *BLANKS 1 #LISTCOUNT)
Begin_Loop Using(#STD_NUM) To(#LISTCOUNT)
Execute Subroutine(GET_ALPHA) With_Parms(EMPLIST EMPNO #STD_NUM #EMPNO)
Execute Subroutine(GET_ALPHA) With_Parms(EMPLIST SURNAME #STD_NUM #SURNAME)
Execute Subroutine(GET_NUMBER) With_Parms(EMPLIST POSTCODE #STD_NUM #POSTCODE)
Add_Entry To_List(#EMPLIST)
End_Loop
Keywords
Example 219 - Rating: advanced
The Things that Make Up this Example | To Execute this Example |
This example provides a generic framework that you may use to perform Remote Procedure Calls (RPCs) between LANSA RDML functions executing on different iSeries systems.
Arguments may be passed to the called functions and values returned by them:
The remote procedure calls cross the Internet using XML formatted data transferred using the HTTP protocol.
The major SET components in this example are RDML functions SET219Y and SET219Z:
SET219Y and SET219Z provide a generic framework for performing RPCs.
To call an RDML function on a remote iSeries system you call function SET219Y, telling it:
- Details of any arguments (including lists) that you want to pass to the RDML function.
- The name of the function you want to call on the remote system.
- The URL at which the RDML function can be found.
SET219Y then converts the returned XML data back into arguments and returns control back to your function.
This example also provides a number of specific examples of how to use the SET219Y/Z generic framework to perform remote procedure calls:
SET219A and B demonstrate the essentials of how arguments are passed to and returned by remote procedures.
They do this by performing simple numeric numerical calculations and string manipulations:
SET219C and D demonstrate how you might pass data base information between functions.
They do this by providing a simple employee details and skills enquiry that uses the shipped LANSA demonstration system:
SET219E and F demonstrate how you might pass lists in SET219Y/Z framework.
They use the shipped LANSA demonstration system to demonstrate how a list of employees may be passed between functions:
SET219G and H demonstrate how messages are passed by the SET219Y/Z framework.
They do this by allowing OS/400 commands to be executed on the remote host system.
For more detailed information about how the SET219Y/Z framework may be used refer to the shipped source code of the specific SET219A/B, SET219C/D, SET219E/F or SET219G/H examples.
Detailed Notes and Suggestions
These examples allow the special value local to be specified as the host URL.
When the special value local is used the entire remote procedure call process is short circuited and the called functions are directly invoked. The JSM is not required to execute in this mode and no XML is used. The local facility demonstrates the flexibility of the SET219Y/Z generic framework in that local procedure calls may proceed at optimal speed. For SET219Y/Z framework user applications (eg: SET219A and SET219B) the local facility is both functionally identical to a remote procedure call and completely transparent.
The parameter and list passing facilities that the SET219Y/Z generic framework provides are based on a simple symbolic name / value system. In essence, a list of named values is exchanged between the application on the client and the application on the remote host.
The SET219A/B, SET219C/D, SET219E/F and SET219G/H examples interface to the named value list by using these simple subroutines:
SET_ALPHA | Sets a named alphanumeric value into the named value list |
SET_NUMBER | Sets a named numeric value from the named value list |
GET_ALPHA | Gets a named alphanumeric value from the named value list |
GET_NUMBER | Gets a named numeric value from the named value list |
If you look at the source code of one of the example functions (eg: SET219C) you will see executions of these subroutines that are structured like this:
where:
Symbolic Name Part 1 | Is the first part of the symbolic name assigned to the value. |
Symbolic Name Part 2 | Is the second part of the symbolic name assigned to the value. For simple fields this is most commonly specified as *Blanks as the first part of the name uniquely identifies the value. |
Instance Number | Is the instance (ie: occurrence) number of the value. Lists of named values are easily formed by using different instance numbers. Most simple fields use the value 1. |
Actual Value | Is the field that contains (or is to contain) the actual value associated with the symbolic name. |
Here are some simple examples of using these interfaces:
This example sets the current value of field #EMPNO into the list with name EMPNO as instance number 1:
Execute Subroutine(SET_ALPHA) With_Parms(EMPNO *BLANKS 1 #EMPNO)
This example sets the current value of field #REQEMPNO into the list with name EMPNO as instance number 1.
Execute Subroutine(SET_ALPHA) With_Parms(EMPNO *BLANKS 1 #REQEMPNO)
This example creates a symbolic list named EMPLIST of employee numbers, names and post/zip codes by using both symbolic names 1 and 2 and a variable instance number. It also creates a single simple name EMPCOUNT that indicates how many entries were placed in the list:
Select Fields(#EMPNO #SURNAME #GIVENAME #POSTCODE) From_File(PSLMST2) With_Key(#SURNAME) Generic(*Yes)
Change Field(#LISTCOUNT) To('#LISTCOUNT + 1')
Execute Subroutine(SET_ALPHA) With_Parms(EMPLIST EMPNO #LISTCOUNT #EMPNO)
Execute Subroutine(SET_ALPHA) With_Parms(EMPLIST SURNAME #LISTCOUNT #SURNAME)
Execute Subroutine(SET_NUMBER) With_Parms(EMPLIST POSTCODE #LISTCOUNT #POSTCODE)
Endselect
Execute Subroutine(SET_NUMBER) With_Parms(EMPCOUNT *BLANKS 1 #LISTCOUNT)
This example retrieves the symbolic list named EMPLIST created in the previous example and copies it into a browse list named #EMPLIST:
Def_List Name(#EMPLIST) Fields(#EMPNO #SURNAME #POSTCODE)
Clr_List Named(#EMPLIST)
Execute Subroutine(GET_NUMBER) With_Parms(EMPCOUNT *BLANKS 1 #LISTCOUNT)
Begin_Loop Using(#STD_NUM) To(#LISTCOUNT)
Execute Subroutine(GET_ALPHA) With_Parms(EMPLIST EMPNO #STD_NUM #EMPNO)
Execute Subroutine(GET_ALPHA) With_Parms(EMPLIST SURNAME #STD_NUM #SURNAME)
Execute Subroutine(GET_NUMBER) With_Parms(EMPLIST POSTCODE #STD_NUM #POSTCODE)
Add_Entry To_List(#EMPLIST)
End_Loop
Keywords
Example 219 | JSM |
JSM | Remote Procedure Call |
Internet | RPC |
Web | XML |
ISeries | OS/400 |
XML Fragments | LANSA Integrator |