The Custom interface type is used to interact with interfaces that are not defined as dedicated interface types in Fabric, such as SSH or any interface that requires a user, password, port and host.
A Custom interface type can be used to store encrypted passwords. For example, to connect to a website using a user and a password, use the getCustomProperties API in the user code to get the password's original value.
To create a new interface, do the following:
Go to Project Tree > Shared Objects, right click Interfaces, select New Interface and then select Custom from the Interface Type dropdown menu to open the New Interface window.
Populate the connection's settings and click Save.
Parameter | Description |
Host | Hostname or IP address of the server. |
Port | Port ID. |
User | Username. |
Password | Password. |
Data | Any additional parameters defined for the customer interface. |
Define a Custom interface.
In the Fabric user code, get the connection's details using the getCustomProperties() API as follows:
String remoteFile = "/home/k2view/Test-Automaton-Report.html";
Map<String, String> props = getCustomProperties("CustomInterface");
String user = props.get("User");
String password = props.get("Password");
String host = props.get("Host");
int port = Integer.parseInt(props.get("Port"));
JSch jsch = new JSch();
Session session = jsch.getSession(user, host, port);
session.setPassword(password);
session.connect();
log.info("Connection established.");
ChannelSftp sftpChannel = (ChannelSftp) session.openChannel("sftp");
sftpChannel.connect();
log.info("SFTP Channel created.");
InputStream inputStream = sftpChannel.get(remoteFile);
Map <String,String> mapInterface = getCustomProperties("myCustInterface");
final String USERNAME = mapInterface.get("User");
final String PASSWORD = mapInterface.get("Password");
String encodedUPass = Base64.getEncoder().encodeToString((USERNAME+":"+PASSWORD).getBytes(StandardCharsets.UTF_8.name()));
The Custom interface type is used to interact with interfaces that are not defined as dedicated interface types in Fabric, such as SSH or any interface that requires a user, password, port and host.
A Custom interface type can be used to store encrypted passwords. For example, to connect to a website using a user and a password, use the getCustomProperties API in the user code to get the password's original value.
To create a new interface, do the following:
Go to Project Tree > Shared Objects, right click Interfaces, select New Interface and then select Custom from the Interface Type dropdown menu to open the New Interface window.
Populate the connection's settings and click Save.
Parameter | Description |
Host | Hostname or IP address of the server. |
Port | Port ID. |
User | Username. |
Password | Password. |
Data | Any additional parameters defined for the customer interface. |
Define a Custom interface.
In the Fabric user code, get the connection's details using the getCustomProperties() API as follows:
String remoteFile = "/home/k2view/Test-Automaton-Report.html";
Map<String, String> props = getCustomProperties("CustomInterface");
String user = props.get("User");
String password = props.get("Password");
String host = props.get("Host");
int port = Integer.parseInt(props.get("Port"));
JSch jsch = new JSch();
Session session = jsch.getSession(user, host, port);
session.setPassword(password);
session.connect();
log.info("Connection established.");
ChannelSftp sftpChannel = (ChannelSftp) session.openChannel("sftp");
sftpChannel.connect();
log.info("SFTP Channel created.");
InputStream inputStream = sftpChannel.get(remoteFile);
Map <String,String> mapInterface = getCustomProperties("myCustInterface");
final String USERNAME = mapInterface.get("User");
final String PASSWORD = mapInterface.get("Password");
String encodedUPass = Base64.getEncoder().encodeToString((USERNAME+":"+PASSWORD).getBytes(StandardCharsets.UTF_8.name()));