Asking for help!! Open connection via WinSCP in Powerbuilder10.

Advertisement

tiver109
Joined:
Posts:
2
Location:
Taiwan

Asking for help!! Open connection via WinSCP in Powerbuilder10.

HI everyone, I get some problem when I'm trying to open a ftp connection via WinSCP in Powerbuilder10. Hope that someone can help me. Orz

This is my Code :

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

There are two problem that I've got.

First is the propertise of SessionOptions Protocol. I know that document say that the value will be something like Protocol.Sftp or Protocol.ftp. but I can't make powerbuilder recognize type protocol, so I set it to integer value 2(
assuming it's start from 0). How can i set this propertise?

Second is I get the error when running open method. The error just says "Error calling external object function open at line xx in clicked event .....", and OLERuntimeError exRuntime is always null.

p.s I've already Registry the dll. the li_err when connecttonewobject is 0.
Can anyone help me? Thanks a lot!!

tiver109, 20180604

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,300
Location:
Prague, Czechia

Re: Asking for help!! Open connection via WinSCP in Powerbuilder10.

I have no experience with PowerBuilder.
But do try setting lo_Session.SesisionLogPath = "C:\some\path\session.log"
And inspect the log file, or attach it here.

Reply with quote

tiver109
Joined:
Posts:
2
Location:
Taiwan

Re: Asking for help!! Open connection via WinSCP in Powerbuilder10.

martin wrote:

I have no experience with PowerBuilder.
But do try setting lo_Session.SesisionLogPath = "C:\some\path\session.log"
And inspect the log file, or attach it here.

Hi, Martin
Thanks for your reply !
I've set the SesisionLogPath, but it's didn't generat anything.
And I try to create a .log file before i excute the program. The .log file still be empty.

This is how I set :
lo_Session.SessionLogPath = "C:\winscp\session.log"

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
29,300
Location:
Prague, Czechia

Re: Asking for help!! Open connection via WinSCP in Powerbuilder10.

Sorry, we cannot help you with PowerBuilder.

Reply with quote

Advertisement

You can post new topics in this forum