SFTP [error occur when put files]

In my flow service, after log in SFTP server successfully, there is a error occur before put file. The error is like “Invalid session {user alias}: {session key}”.

Can you share the version of webMethods? and also the exact error message if possible.

The version is 9.8.

The error message is: “[test] – [ISS.0086.9313] Invalid session 1stSFTPuser:1471576619918”

In your flow service are you using different steps to login to server and then putting your files to remote directory?
If after login step you are closing the session then the put step may not be able to open a new session.

Are you connecting to your sftp server via any load balancer?
Do you succesfully get the session key from login api? If yes, are you reusing this key?
Please mention your Fix level as well.

Hi Khan,

  1. My SFTP server is the free&simpiest one- Core FTP mini-sftp server. It seems that there is not load balancer even.
  2. I am sure that I get the session key after log in. Since I see it from the debug log and error message is: “[test] – [ISS.0086.9313] Invalid session 1stSFTPuser:1471576619918”.
  3. Not sure what is reusing the key. My SFTP operation is Log in → read data from a specific file → Pass steam as input paramenter contentSteam of pub.client.sftp.put → log out.
  4. Strangely, I found that there is another error “One or more required values are missing:{localFile, contentStream}” occur when I didn’t value the input parameter “localFile” of pub.client.sftp.put. While when I value the “localFile”, “Invalid session {user alias}: {session key}” occur.

I tested this service with these SFTP step and it was OK. Somehow, it fails now. So confused I am.

Hi Aaron,

please provide your Fix Level, esp. IS_9.8_Core_Fix and SCG_9.8_TPL_Fix, as these contain updates relevant for using SFTP.

Reusing the session key means, that after logging in to the SFTP ServerAlias/UserAlias combination you persist this variable in the pipeline and map it as an input to all subsequent sftp calls like put, get, logout.

Make sure that this value is available inside branches, loops, repeats, sequences etc. if neccessary.
If if the variable seems to be available in the pipeline by design time it might be possible that this is not the case in run time as the scope might have changed which you were not aware of at design time.

Can you share a complete outline of your service?

Regards,
Holger

In addition to the above comments. Make sure your flow service follows the below code snippet

LoginToSFTP service (do not drop sessionKey)
Main (Success)
Try (Failure)
do all your SFTP operations
Logout from SFTP (pass the same session Key)
Catch (Done)
getLastError
Logout from SFTP (pass the same session Key)

OR

Main (Success)
Try (Failure)
LoginToSFTP service (do not drop sessionKey)
do all your SFTP operations
Logout from SFTP (pass the same session Key)
Catch (Done)
getLastError
Logout from SFTP (pass the same session Key from getLastError/pipeline)

  1. Create a sftp user alias with name of “webm”.
  2. Configure appropriate target server alias for it and test the connection.
  3. Create a dummy file /app/testput.txt in your Integration Server Box. You may chose any file name and any path as you like.
  4. Create a global variable “localFile” with your source local file path mentioned above. Path should be fully qualified like /app/testput.txt
  5. Install attached package SFTPTest.zip in your problem IS.
  6. Run service SFTPTest.services:putService and let us know if you are still getting any error.
  7. After running this service you should be able to see your dummy file in your home directory of SFTP server.
    SFTPTest.zip (6.12 KB)