SFTP w/ Microsoft Dynamics Nav (Navision) - WeOnlyDo Discussion board

SFTP w/ Microsoft Dynamics Nav (Navision) (General questions)

by Josh, Monday, November 05, 2007, 15:44 (6228 days ago)

Hello, I am having an error when trying to connect to a sftp server through Dynamics Nav.

I am having trouble connecting to the server, and have tried a variety of ways. My code is as follows:

[code]
Name DataType Subtype Length
ftp1 Automation 'WeOnlyDo! COM SFTP Client ActiveX Control'.wodSFTP
//declared variable ^

CREATE(ftp1);

ftp1.Hostname := 'xxx.xxx.xxx.xxx';
ftp1.Port := 22;
ft4p1.Login := 'username';
ftp1.Password := 'password1';
ftp1.Connect;
ftp1.RemotePath := '/my/remote/directory/';
ftp1.MakeDir('testdir/');


[/code]

I have also tried assigning the controls to variables too:

[code]
host := ftp1.hostname('xxx.xxx.xxx.xxx');
etc
[/code]
and then connecting using

[code]
ftp1.connect(host,port);
[/code]

I have also tried
[code]
ftp1.hostname('xxx.xxx.xxx.xxx');
[/code]

All of the above ways are legal according to Nav..
However, once the code reaches the 'makedir' control I get the following error:

The call to member MakeDir failed. WeOnlyDo.wodSFTP.1 returned the following message:
Cannot send/receive/list at this time, not connected.


I was simply wondering if anyone had any ideas as to why it might not be connecting?
The server I am trying to connect to is SFTP (using SSH2) and on port 22.

Any ideas/comments(/solutions!) would be greatly appreciated,

Thanks in advance,

Josh

Re: SFTP w/ Microsoft Dynamics Nav (Navision)

by wodDamir, Monday, November 05, 2007, 15:49 (6228 days ago) @ Josh

Hi Josh,

Please try setting Blocking mode to true. You can do that by setting the Blocking Property.

The reason why you receive this error, is because the MakeDir and ListDir are being executed before you really connected to server. When using the component this way (scripting) and you wish to execute your code line-by-line, Blocking mode is required. It will ensure that each method is executed before proceeding to the next line in your code.

However, if you don't want to use Blocking mode, you need to use the Event system (and Done Event) in order to issue multiple commands.

Hope I helped.

Regards,
Damba

Re: SFTP w/ Microsoft Dynamics Nav (Navision)

by Josh, Monday, November 05, 2007, 15:59 (6228 days ago) @ wodDamir

Well, that sorted that.

I had a timeout issue, so I pointed it to a different server - and it seemed to have worked... No timeout errors etc.

However, it didn't make the directory. Now, if I try to run it, I get this partically informative message(heh heh):

Server Returned and Error: General failure.
It is again referring to the MakeDir call - there's nothing else I'm missing, is there?

Thanks a lot for the previous post though - helped a lot :)


Re: SFTP w/ Microsoft Dynamics Nav (Navision)

by wodDamir, Monday, November 05, 2007, 16:06 (6228 days ago) @ Josh

Josh,

Are you specifying the full path to the folder you want to create?

I.e, if /my/remote/directory/ is your current directory, and you wish to add another subdirectory in there, you would need to call the MakeDir method with /my/remote/directory/subdirectory/ parameter.

Can you try that?

Regards,
Damba

Re: SFTP w/ Microsoft Dynamics Nav (Navision)

by Josh, Monday, November 05, 2007, 16:21 (6228 days ago) @ wodDamir

Works a charm.

Is it possibly in this 'scripting' method to supply the license key (when I purchase a license) or can than not happen in this instance?

Thanks again :)

Josh

Re: SFTP w/ Microsoft Dynamics Nav (Navision)

by woddrazen, Monday, November 05, 2007, 16:30 (6228 days ago) @ Josh

Hi Josh,


You can insert LicenseKey using wodSFTP LicenseKey Property. Only licensed version of wodSFTP have LicenseKey Property.

DEMO version don't have such property because you don't need it.

Here is example how to add LicenseKey Property and LicenseKey to your code:
[code]ftp1.LicenseKey := 'XXXX-XXXX-XXXX-XXXX';
ftp1.Connect;[/code]

Drazen

Re: SFTP w/ Microsoft Dynamics Nav (Navision)

by Josh, Monday, November 05, 2007, 16:56 (6227 days ago) @ woddrazen

Okay, brilliant, thank you :)

If I am developing the script for a client, and they are running the script, how licenses would this require?

I'll obviously need one of the developmental licenses, does my client require any sort of license at all or does I simply put my license key into the code and that allows the code to run with no popup box displaying?

Thanks, sorry for the (possibly) silly question


Josh

Re: SFTP w/ Microsoft Dynamics Nav (Navision)

by woddrazen, Monday, November 05, 2007, 17:24 (6227 days ago) @ Josh

Josh,


License is per developer.

So if your client just using your script than you should only purchase 1 developer license and distribute wodSFTP.ocx or wodSFTP.dll on client machine.

If your client are designing your wodSFTP code than they should also purchase license for wodSFTP.

You will not receive any popup message box in licensed version.


Drazen