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
‎07-16-2018 04:25 AM
Hi
then for this purpose maybe you need a mid server.
Thanks 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2018 04:39 AM
Is it impossible to do it without a mid server? My corporation doesn't intend to add a mid server to prod instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2018 04:41 AM
Hi
I dont think so because if you are trying to send something through web to another location. It needs a mid server as far as my knowledge.
Thanks 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2023 08:57 PM
Links are not opening giving error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2018 06:27 AM
Hi Michael,
Did you figure out a way around to establish SSH connection to push file to SFTP server ? I am trying to achieve the exact thing, and I am facing the same error as yours -
Evaluator: com.sshtools.j2ssh.transport.TransportProtocolException: The connection did not complete