infoRPA for MuleSoft
Overview
Companies that run their core systems of record on IBM i (formerly known as AS400 or iSeries) are often dependent on their application vendors when they need to integrate these applications or automate manual user actions. infoRPA for MuleSoft is an automation connector that runs directly inside a MuleSoft application. It simulates green-screen user actions such as navigation, data entry, and screen capture.
Use cases
You have several options for integrating and automating IBM i based applications. Robotic Process Automation (RPA) is a good fit for companies that can access the application only through the green-screen UI and have limited options for integrating at the application program or database level. If users have to key data into a legacy system manually, this step is a good candidate for automation.
RPA also helps with test automation, a scenario that is often overlooked. Companies often run manual feature and regression tests every time a change is introduced. Automating the regression tests can improve the quality of releases and reduce the risk of unintended changes in system behavior.
Product features
- Automates manual green-screen operations and surfaces legacy IBM i applications as modern APIs.
- Simulates green-screen user actions directly from MuleSoft applications.
- Automates user screen navigation and data entry for IBM i screen (tn5250) applications.
- Supports a Python based script language for advanced screen navigation logic.
- Supports TLS (encrypted) connections.
License
infoRPA for MuleSoft is offered under the GPL 2 open source license. See GNU General Public License, Version 2.
How it works
infoRPA is a MuleSoft plug-in. It opens an IBM i telnet (5250) session and executes a sequence of user actions: it navigates the screens, types data into display fields, presses function keys, and reads sections of the screen into variables.
The connector runs entirely within the MuleSoft application and does not require any other software.
The connection configuration includes the credentials and the initial set of keystrokes that every session executes to reach the starting point of the screen navigation (for example, the Order Entry screen).
The connector operation executes the script (a series of keystrokes, macro executions, and so on) and passes the resulting variables back to the Mule flow.
MuleSoft and IBM i requirements
- The connector is available for MuleSoft Enterprise and Community (Kernel) editions.
- The minimum supported MuleSoft runtime version is 4.2.0.
- Any IBM i OS version is supported.
Installation
infoRPA for MuleSoft is distributed as a Maven dependency. To add the connector to a MuleSoft project, add the following dependency and repository to the pom.xml file of the project.
Dependency section:
<dependencies>
...
<dependency>
<groupId>com.infoview.as400</groupId>
<artifactId>mule-rpa-connector</artifactId>
<version>1.0.2</version>
<classifier>mule-plugin</classifier>
</dependency>
</dependencies>
Repository definition:
<repositories>
...
<repository>
<id>repo</id>
<url>https://pkgs.dev.azure.com/infoviewsystems/repo/_packaging/public/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
After you save the changes, Anypoint Studio downloads and installs the connector into the project automatically.
Connection configuration
| Property | Description | Required | Default value |
|---|---|---|---|
| User Name | User ID. | true |
|
| Username X Position | Starting column of the User ID field on the login screen. | true |
|
| Username Y Position | Row of the User ID field on the login screen. | true |
|
| Password | Password. | true |
|
| Password X Position | Starting column of the password field on the login screen. | true |
|
| Password Y Position | Row of the password field on the login screen. | true |
|
| Initial Key String | Static set of keys, menu option navigation, and so on, that must be executed when a new session starts. | ||
| Host | IBM i IP address or server name. | true |
|
| Port | Telnet port. | true |
|
| SSL Type | Encryption and certificate type. Valid values: NONE (default, no encryption), SSL, and TLS. |
true |
|
| Debug Mode | Optional. When set to true, the connector prints the screen after each keystroke is executed. |
||
| Reconnection Attempts | Number of times the connector retries the reconnection. Defaults to 1. | ||
| Time Between Attempts (ms) | Number of milliseconds between refresh attempts. Defaults to 300. |
Execute script operation
| Property | Description | Required | Default value |
|---|---|---|---|
| Key String | Sequence of key strokes, functional keys, literals, variables, or special commands that represents the user actions on the screen. See Key names and Special commands. | Required | |
| Input Parameters | Mapping for the input parameters. | Required | Default Value |
| Macro File | Name of the macro file (Python script). | ||
| Macro Input Parameters | Name and value of the input variables passed into the macro script. | ||
| Macro Output Parameters | Name and value of the output variables passed from the macro script. |
Key names
The following table lists the standard key codes that the connector supports. Enter the keys exactly as listed. Separate each key, literal, variable, and special command with a comma.
| Key code | Description |
|---|---|
[backspace] |
Back Space |
[backtab] |
Back Tab |
[up] |
Cursor Up |
[down] |
Cursor Down |
[left] |
Cursor Left |
[right] |
Cursor Right |
[delete] |
Delete |
[tab] |
Tab |
[eof] |
End of Field |
[eraseeof] |
Erase EOF |
[erasefld] |
Erase Field |
[insert] |
Insert |
[home] |
Home |
[keypad0] |
Keypad 0 |
[keypad1] |
Keypad 1 |
[keypad2] |
Keypad 2 |
[keypad3] |
Keypad 3 |
[keypad4] |
Keypad 4 |
[keypad5] |
Keypad 5 |
[keypad6] |
Keypad 6 |
[keypad7] |
Keypad 7 |
[keypad8] |
Keypad 8 |
[keypad9] |
Keypad 9 |
[keypad.] |
Decimal |
[keypad,] |
Comma |
[keypad-] |
Keypad minus |
[fldext] |
Field Exit |
[field+] |
Field Plus |
[field-] |
Field Minus |
[bof] |
Beginning of Field |
[enter] |
Enter |
[pf1] |
F1 |
[pf2] |
F2 |
[pf3] |
F3 |
[pf4] |
F4 |
[pf5] |
F5 |
[pf6] |
F6 |
[pf7] |
F7 |
[pf8] |
F8 |
[pf9] |
F9 |
[pf10] |
F10 |
[pf11] |
F11 |
[pf12] |
F12 |
[pf13] |
F13 |
[pf14] |
F14 |
[pf15] |
F15 |
[pf16] |
F16 |
[pf17] |
F17 |
[pf18] |
F18 |
[pf19] |
F19 |
[pf20] |
F20 |
[pf21] |
F21 |
[pf22] |
F22 |
[pf23] |
F23 |
[pf24] |
F24 |
[clear] |
Clear |
[pgup] |
Page Up |
[pgdown] |
Page Down |
[rollleft] |
Roll Left |
[rollright] |
Roll Right |
Special commands
[MACRO]executes the macro file. Specify the macro file name in the Macro File parameter.[SET_INFIELD x y]positions the cursor on the input field at column x, row y.[GET_SCREEN x y length height variable-name]reads a rectangular screen area that starts at column x and row y, with a horizontal size oflengthcharacters and a vertical size ofheightcharacters. The output is stored invariable-nameand passed back into the Mule flow or script.
Parameter mapping
To set the value of input fields dynamically, use the pattern :<variable-name> in the script. For example, the following snippet positions the cursor at column 29, row 10, inserts the content of the variable uri, and then sends the Enter key:
Define the variables in the Input Parameters section of the connector operation as a list of name and value pairs. For example, the following expression maps the variable to the customerId value of the Mule flow, which comes from the HTTP request:
Example
- Watch the walk-through of this example: infoRPA for MuleSoft Demo Video.
- Get the complete source code: infoRPA MuleSoft Demo Source Code.
Connector configuration XML:
<as400-rpa-connector:execute-script doc:name="Execute script" doc:id="5948925f-c53b-4a07-a5db-0b5b0d571500" config-ref="Config_TLS"
inputParameters='#[{"uri":attributes.uriParams.customerId}]' fileName="addItems.py" macroInputParameters='#[{"items": payload.Items}]'>
<as400-rpa-connector:key-string >
<![CDATA[call cdcordcmtc,[enter],[SET_INFIELD 29 10],:<uri>,[enter],[enter],[pf6],[MACRO],[pf10],[GET_SCREEN 15 4 8 1 orderNum],[GET_SCREEN 2 24 13 1 orderStatus],[pf12],[pf3]]]>
</as400-rpa-connector:key-string>
</as400-rpa-connector:execute-script>
Python script example:
from org.tn5250j.framework.tn5250 import Rect
print "--------------- tn5250j add items script start -------------"
textBox = Rect()
i = 9
for item in items:
field = _session.getScreen().getScreenFields().findByPosition(i-1, 2)
field.setString(str(item["ItemNo"]))
field = _session.getScreen().getScreenFields().findByPosition(i-1, 14)
field.setString(str(item["ItemName"]))
field = _session.getScreen().getScreenFields().findByPosition(i-1, 46)
field.setString(str(item["Quantity"]))
field = _session.getScreen().getScreenFields().findByPosition(i-1, 53)
field.setString(str(item["UnitPrice"]))
i = i + 1
_session.getScreen().sendKeys("[enter]")
_session.getScreen().sendKeys("[enter]")
print "---------------- tn5250j add items script end -------------"
In this example, the connector does the following:
- Executes a call to the order maintenance program and presses Enter.
- Sets the cursor to column 29, row 10, types the value of the variable
uri, and presses Enter twice. - Sends the F6 key event to navigate to a new screen.
- On the new screen, executes the Python macro, which receives the
Itemsobject from the API request body. For each line item, the macro types the data into the appropriate input fields of the Add Order lines subfile and presses Enter. - After the order is entered, presses F10 to create the new order in the system.
- Retrieves the newly generated order ID and status from the specified screen positions.
- Returns to the Work with Orders screen to prepare for the next transaction.