SFTP How to

Dear all,

Tried my level best to impleiment sFTP connectivity from IS 6.1 - but failed!

Can anyone tell us how to? We followed the steps given in advantage by using OpenSSH package suggested by webMethods.

Thanks in advance,
Anil Kurnool

PS:: If you have implimented it, please give your voice number, will call you.

Hello,
Not really helpful advice, but it may be nice for a responder to type in some of those procedures for a working implementation as “all” will benefit. Not only that, but there may be some optimizations or safeguarding tips that can be exchanged across messages. Thank you.

Anil,

I would suggest turning on debug on both client and server side to see where the public key auth is failing. You should see something like this:

$ ssh -v yourhostname:
. . .
debug1: Next authentication method: publickey
debug1: Trying private key: /home/tbond/.ssh/identity
debug1: Offering public key: /home/tbond/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 149
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.

It can be permissions on the authorized_keys file on the server side (they need to be locked down).

I am posting this as a follow up to what Anil has posted. I work with him. We have created a java service and tried to execute it from a standalone java program and it works. When we do it from webMethods we get the following error in the sftp server (WinSSHD)

094] WinSSHD 3.28d: Session thread 1009 handling
connection from 192.168.1.13:4173:
The client has been disconnected, we sent the
following disconnect reason:
SSH_DISCONNECT_KEY_EXCHANGE_FAILED, description:
invalid DH value

The same keys and ids work in standalone mode. We had the same problem when we tried simple password authentication without keys. In that case the standalone java program is working while from WM integration server flow service it does not.

Update >>>

We changed the sFTP server from winSSH to openSSH server. The services in the openSSH package are working fine now and are able to do the transport.

Why?

Any inputs in this regard is welcome.

Regards
Anil

Hi Anil,
Could you please provide the steps/document to impliment SSH on webMethods to send file to another server.
Your help is highly appreciated .

Regards
Rav

Hi Anil and co,

I’ve written my own SFTP package using Java services based on the JSch library as stated in some of the forum posts.

I’ve put a copy of this on the public wiki of my company. here is a link:
http://www.customware.net/repository/display/WMFAQ/How+to+use+SFTP+in+webMethods

Regards,

Aditya Gollakota

Hi All,

I’ve implemented my own SFTP using JSch and writing Java services

Refer to this link - [url]http://www.customware.net/repository/display/WMFAQ/How+to+use+SFTP+in+webMethods[/url]

Hi Aditya,
Thanks for your code, it’s excellent.
Regards
Rav

Hi,

I am having a requirement to get a file from a SFTP server. When I searched in WMUSERS I found this thread where I see a solution for my problem. I have downloaded the package BW_Utilities.zip and installed it. Also I have downloaded the jar jsch-0.1.37.jar and copied to ./Integration Server/lib/jars/ and re-started the IS.

However when I tried to login i am getting the following output…

channleSFTp # null
Session Factory # com.jcraft.jsch.Session
Status # Unable to connect to FTP server. com.jcraft.jsch.JSchException: Session.connect: java.io.IOException: End of IO Stream Read

If anybody can throw some light on this issue and help me out it would be a great help.

Thanks in advance…

— Ram

Hi Aditya,
Thanks for your package. The code works great!!!
Thanks again… it saved a lot of time for me.
Priyanka

Hi Ram

Coould you pl. share the link from where you have got this BW_Utilities package ?

Regards
Dimpy Sanghvi

Hi Sanghvi,
If you are looking for code to connect to SFTP server from webMethods, below links will help you.

[URL]http://wiki.customware.net/repository/display/WMFAQ/How+to+use+SFTP+in+webMethods[/URL]

The above link has the code to work with Sftp… Some sftp servers will work only with certificates, and password might not be required. In such case, remove/comment the below line from the code, and you should be set to connect to SFTP server.

session.setPassword(ftpPassword);

[URL]http://webmethodsarchitect.com/integrationserver/11[/URL] - this has a package attached, it should help u… (i didnt check the content of the package)

HTH
Senthil

Here is one more link to go through …and understand it better.

[URL]http://vinayak-bhandurge.blogspot.in/2008/11/how-to-go-about-ftps-implementation-at.html[/URL]

Regards,
Amol.

Hi Ram,

Even I am also facing the same problem while connecting to the SFTP server.

Unable to connect to FTP server. com.jcraft.jsch.JSchException: java.net.ConnectException: Connection refused: connect

May I know what could be the reason?

Thanks,

Which package are you using SFTP implementation?

OpenSSH or waSFTP (unofficially support but works)?

HTH,
RMG

Thanks a lot for your package Aditya.

I have implemented sftp with a java service. When I tried to upload the catalog from webMethods it throws an exception, but when I run the java program in eclipse and give the path of input file and provide the destination file name it works fine.

Any suggestions?

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:686)
at com.jcraft.jsch.ChannelSftp.remoteAbsolutePath(ChannelSftp.java:2186)
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:331)
at com.jcraft.jsch.ChannelSftp.put(ChannelSftp.java:319)
at PngUtilities.SSSH.sshPwdAuthentication(SSSH.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:443)
at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:643)
at com.wm.app.b2b.server.util.tspace.ReservationProcessor.process(ReservationProcessor.java:41)
at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:44)
at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:243)
at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:51)
at com.wm.app.b2b.server.invoke.PipelineProcessor.process(PipelineProcessor.java:171)
at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:282)
at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:30)
at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:363)
at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:547)
at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:386)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:244)
at com.wm.app.b2b.server.comm.DefaultServerRequestHandler.handleMessage(DefaultServerRequestHandler.java:119)
at com.wm.app.b2b.server.HTTPMessageHandler.process(HTTPMessageHandler.java:160)
at com.wm.app.b2b.server.HTTPDispatch.handleRequest(HTTPDispatch.java:186)
at com.wm.app.b2b.server.Dispatch.run(Dispatch.java:368)
at com.wm.util.pool.PooledThread.run(PooledThread.java:131)
at java.lang.Thread.run(Thread.java:662)

Information about SFTP for Upgraders to wM 9.5 or newer:

You should consider to migrate to the new build-in SFTP-feature introduced in IS 9.5.

Benefits:

  • no need to custom code the handler any longer
  • documented in the Build-In-Sevices Guide
  • officially supported by SAG

Regards,
Holger