How to send a file using SFTP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2018 02:18 AM
I want to send a csv file from ServiceNow to other server using SFTP. I tried j2ssh package:
var ssh = Packages.com.sshtools.j2ssh.SshClient();
var ignore = Packages.com.sshtools.j2ssh.transport.IgnoreHostKeyVerification();
var pwd = Packages.com.sshtools.j2ssh.authentication.PasswordAuthenticationClient();
pwd.setUsername(this.username);
pwd.setPassword(this.password);
var properties = Packages.com.sshtools.j2ssh.configuration.SshConnectionProperties();
properties.setHost(this.hostname);
properties.setPort(this.port);
var output = Packages.java.io.ByteArrayOutputStream();
ssh.connect(properties, ignore);
At first I tried to establish SSH connection and then switch to SFTP but I'm always getting error at ssh.connect line:
Evaluator: com.sshtools.j2ssh.transport.TransportProtocolException: The connection did not complete
Any advice how to connect to an SFTP? Maybe there are other packages for it in ServiceNow, btw I don't have a Mid-Server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2018 06:46 AM
I eventually gave up and used FTP instead using Packages.org.ftp4che. If you really need SFTP then you should find a solution with the MID Server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2018 07:19 AM
Ok, thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 10:24 PM
Did you find the way to connect to SFTP?