Title: Question about Win32-OLE

Hi Jan,

 

Thanks for the assist. I apologize for the HTML. I'm using Outlook and it is set for "Plain Text" so I don't yet know where the HTML is coming from. This is a company computer so much of the configuration is locked in. I'll try to find the problem.

 

The actual code (perl and vbs) does have error trapping. Neither perl or vbs report errors on instantiation. Perl reports an error on connect and vbs does not. Here is a clone of my reply to Timothy Johnson...

 

<quote>

Here is the error trapping added (changed die to warn) which produces the output as I originally stated.

 

$SFTPServer->connect( $Server, $Port, $UserName, $Password ) or warn "Could not connect as $UserName to $Server:$Port!";

print "Win32::OLE->LastError()."\n"if(Win32::OLE->LastError());

 

If I intentionally provide an incorrect $UserName or $Password I get this:

 

<snip>

Could not connect as Admin to localhost:1000! at C:\Source\SFTPTest.pl line 7

OLE exception from "SFTPCOMInterface.CIServer.1":

 

 [Error:5-'SSL Error']

 

Win32::OLE(0.1703) error 0x80004005: "Unspecified error"

         in METHOD/PROPERTYGET "connect"

<snip>

 

If I intentionally configure the SFTP server to NOT allow connections, I get this:

 

<snip>

Could not connect as Admin to localhost:1000! at C:\Source\SFTPTest.pl line 7

OLE exception from "SFTPCOMInterface.CIServer.1":

 

 [Error:2-'Remote Admin disallowed']

 

Win32::OLE(0.1703) error 0x80004005: "Unspecified error"

         in METHOD/PROPERTYGET "connect"

<snip>

 

I suspect that when the Error 2 or 5, does NOT appear, then the parameters are being received correctly by the server COM interface. But the connection is still failing. The Error 2 and 5 appears to be correctly reporting the test conditions, again, the parameters appear to be okay. Thus my conclusion is that this is way beyond me ;-) Possibly something in the OLE internals?

 

The server vendor has some old perl code samples that use the ancient OLE (not Win32::OLE) package. That package uses CreateObject() instead of  new() methods. Could be something hinky here, too. Bottom line, it seems like if it works in VBS it should also work in perl. I hate to kludge my ftp client with a lot of VBS unless I have to.

 

Thanks again and best regards,

Sturdy

 

 


From: Jan Dubois [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 24, 2006 5:34 PM
To: [EMAIL PROTECTED]; [email protected]
Subject: RE: Question about Win32-OLE

 

It is not clear that the Connect() call failed.  Is it defined to return a true value if it succeeds?  Your _vbscript_ code is not checking the return code of Connect() at all.

 

If the connection is indeed failing, then you should try to print out Win32::OLE->LastError as part of your error message to see what is going on.

 

Cheers,

-Jan

 

PS: Please use plain text for mailing list messages.  Thanks!

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: May 24, 2006 11:59 AM
To: [email protected]
Subject: Question about Win32-OLE

 

Hi all,

I am having a problem accessing a commercial SFTP server app (non-MS). My code is below. I can instantiate the object but the connect method refuses to establish the connection.

use Win32::OLE;
my $Server = "localhost";
my $Port =  "1000";
my $UserName = "Admin";
my $Password = "Admin";
my $SFTPServer = Win32::OLE->new("SFTPCOMInterface.CIServer");
$SFTPServer->connect( $Server, $Port, $UserName, $Password ) or die "Could not connect as $UserName to $Server:$Port!";

The above simple script throws this error:
Could not connect as Admin to localhost:1000! at C:\Source\SFTPTest.pl line 7.

I feel the parameters are being accepted because if I change $UserName or $Password, then I get a msg that logon failed.

These same parameters work in this VBS:
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
      txtServer = "localhost"
      txtPort = "1000"
      txtUserName = "Admin"
      txtPassword = "Admin"
SFTPServer.Connect txtServer, txtPort, txtUserName, txtPassword

Does anyone have a clue as to what might be going wrong? There seems to be an issue with OLE itself but this is beyond me.

Thanks again and best regards,
Sturdy

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to