Re: WinSCP and Powerbuilder
Thanks for sharing your solution.
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
hi tiver109,
did you succed? i am solving similar problem like you.
Sadly, I did't success, so i tried another way, using Microsoft Winnet.dll without SSH.
messagebox("External Error", string(resultcode) + ": " + description)
n_myole s_ftp // for WinSCP.Session
n_myole s_opt // for WinSCP.sessionoptions
n_myole s_trans // for WinSCP.TransferOptions, i just used default values (Binary transfer and overwrite options)
int return_code
s_ftp = CREATE n_myole
return_code = s_ftp.connecttonewobject("WinSCP.Session")
if return_code <> 0 then
messagebox("Error", "S_FTP Component installation error")
return - 1
end if
s_opt = CREATE n_myole
return_code = s_opt.connecttonewobject("WinSCP.sessionoptions")
if return_code <> 0 then
messagebox("Error", "Seasion Options Component installation error")
return - 1
end if
s_trans = CREATE n_myole
return_code = s_trans.connecttonewobject("WinSCP.TransferOptions")
if return_code <> 0 then
messagebox("Error", "Transfer Options Component installation error")
return - 1
end if
s_opt.protocol = 0 // SFTP - i couldn't use WinSCP constans
s_opt.hostname = i_server_ip // server IP
s_opt.UserName = i_user_name // user id
s_opt.Password = i_user_pass // user pass
s_opt.GiveUpSecurityAndAcceptAnySshHostKey = true // this is not save, instead server key should be used
try
any result
result = s_ftp.open(s_opt)
return integer(result)
catch (runtimeerror e)
messagebox("Error",e.getMessage())
return -1
end try
Ll_rtn = integer (s_ftp.putfiles(source_file, target_file, false,s_trans ) )
IF Ll_rtn < 0 THEN
as_msg = "File Upload Error(FTP)!"
END IF
s_ftp.close()
binnary = 0
overwrite = 0
Sorry, we cannot help you with PowerBuilder.
hi tiver109,
did you succed? i am solving similar problem like you.
I have no experience with PowerBuilder.
But do try settinglo_Session.SesisionLogPath = "C:\some\path\session.log"
And inspect the log file, or attach it here.
lo_Session.SesisionLogPath = "C:\some\path\session.log"
integer li_err,li_err2
oleobject lo_SessionOptions, lo_Session, lo_remoteDirectoryInfo, lo_TransferOperationResult, lo_TransferOptions,lo_Protocol
TRY
lo_SessionOptions = create oleobject
li_err = lo_SessionOptions.connecttonewobject("WinSCP.SessionOptions")
lo_sessionOptions.Protocol = 2
lo_SessionOptions.HostName = "192.168.1.50"
lo_SessionOptions.UserName = "ftp_user"
lo_SessionOptions.Password = "123456"
lo_SessionOptions.PortNumber = 21
lo_SessionOptions.FtpMode = 0
lo_Session = create oleobject
li_err2 = lo_Session.connecttonewobject("WinSCP.Session")
if lo_Session.Opened then
lo_Session.Abort()
end if
lo_Session.Open(lo_SessionOptions)
CATCH (OLERuntimeError exRuntime)
messagebox("error",string(exRuntime))
END TRY