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.
Starting from V6.5.1, you can access the custom interface attributes (such as user or password) from a Broadway flow when writing your own custom Actor. In the Actor's Java class, you can access the IoSession by writing the following:
Map m = (Map) context.ioProvider().createSession("my-custom-interface").object(null);
m.get("username");
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.
Go to Project Tree > Shared Objects, right click Interfaces, select New Interface and then select Custom from the Others section to open the New Interface window.
Enter a suitable name for your new Custom Interface, then click Create:
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.
Starting from V6.5.1, you can access the custom interface attributes (such as user or password) from a Broadway flow when writing your own custom Actor. In the Actor's Java class, you can access the IoSession by writing the following:
Map m = (Map) context.ioProvider().createSession("my-custom-interface").object(null);
m.get("username");
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.
Go to Project Tree > Shared Objects, right click Interfaces, select New Interface and then select Custom from the Others section to open the New Interface window.
Enter a suitable name for your new Custom Interface, then click Create:
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()));