EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SFTP On After Transfer command

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#18809
Posted: 01/24/2012 10:43:10
by Pdaalmeyer  (Basic support level)
Joined: 01/24/2012
Posts: 8

Hi There,

I am evaluating the BizCrypto adapter and would like to make use of the On After Transfer command except it doesn't seem to be working.

My requirement is that after I upload a file to create another (empty) file with the same name on the SFTP server with a RDY extension. So for example when the transfer is complete of the file mySampleFile.xml I would have the following two files on my SFTP server:

mySampleFile.xml
mySampleFile.xml.RDY

I first tried using the After Transfer Command

touch %MessageID%.xml.RDY

that didn't work so I simply tried the After Transfer Command

touch foo.txt

this also did not create a file after the transfer. The file that BizTalk was routing was successfully uploaded to the SFTP server in each test.

The log file makes no mention of the After Transfer Command I entered in the adapter configuration:

[24-1-2012 17:41] EldoS SFTP Adapter (send): ProcessMessage()
[24-1-2012 17:41] Searching for installed BizCrypto addons.
[24-1-2012 17:41] BizCrypto.BizTalk.Addons library successfully loaded.
[24-1-2012 17:41] EldoS SFTP Adapter: Loading private key
[24-1-2012 17:41] EldoS SFTP Adapter: 1 keys have been loaded
[24-1-2012 17:41] EldoS SFTP Adapter: Loading trusted keys
[24-1-2012 17:41] EldoS SFTP Adapter: Opening connection to SFTP server
[24-1-2012 17:41] EldoS SFTP Adapter: Running key validation handler
[24-1-2012 17:41] EldoS SFTP Adapter: All keys are trusted, exiting
[24-1-2012 17:41] EldoS SFTP Adapter: Authentication succeeded
[24-1-2012 17:41] EldoS SFTP Adapter: Server introduced himself as OpenSSH_5.3p1 Debian-3ubuntu7
[24-1-2012 17:41] EldoS SFTP Adapter: SFTP connection started
[24-1-2012 17:41] EldoS SFTP Adapter: Remote path is /home/out/4990a685-4391-4fb1-a366-9cfa269c0e04.xml
[24-1-2012 17:41] EldoS SFTP Adapter: Uploading file to SFTP server

Is there a reason why the After tansfer command might not be working?

Many Thanks,

Gary
#18810
Posted: 01/24/2012 10:59:30
by Ken Ivanov (EldoS Corp.)

SFTP protocol does not support issuing of native Unix commands. Thus, all the events (including On After Transfer) only support a limited set of pre-defined commands (these are "extension", "block", "unblock", "copyremotefile", "createsymlink", "createhardlink", "makedir", "removedir", "removefile", "renamefile", "setattributes" and "abspath"). This way, passing the "touch" command won't work as expected.

As a possible solution, you might try creating an empty message in the orchestration and submit a batch of both the original message and the empty one to the send port.

We will also consider extending the list of supported SFTP commands with the "touch" one.
#18816
Posted: 01/25/2012 02:36:14
by Pdaalmeyer  (Basic support level)
Joined: 01/24/2012
Posts: 8

Hi Innokentiy,

Thanks for the reply.

The idea behind the *.RDY file is to create it after the successful upload of the original file, to indicate that it is ready for processing. Your batch suggestion might not be suited to this scenario as ordered delivery with debatching would be required. However using a delivery notification setting on the Orchestration send port would also be a possible solution but it would require the extra overhead of an orchestration and two send actions.

In the documentation I couldn't find the commands you listed above for the command "On After Transfer". Is this documented somewhere?

Just as a matter of interest, does the "On After Transfer" commands support the use of macros like %MessageID%?

Many Thanks,

Gary
#18817
Posted: 01/25/2012 06:12:27
by Ken Ivanov (EldoS Corp.)

Unfortunately, the docs are slightly behind the schedule. We are trying to do our best to have them updated as quickly as possible.

Indeed, the only solution in your case is to use two send ports. Meanwhile, I have passed the task of implementing the "touch" command to the developers, and I reckon this command will be available in the future BizCrypto build update. The update itself is going to be released within a fortnight. I will post a notification here once it is ready for download.
#18818
Posted: 01/25/2012 07:08:13
by Pdaalmeyer  (Basic support level)
Joined: 01/24/2012
Posts: 8

Hi Innokentiy,

Thanks for the feedback and for the helpful offer to build in the touch functionality. I am worried though that this might not meet our requirements.

What we require is the ability to create a confirmation file on the server with the same name as the original file but with a configurable extension (e.g. .RDY) AFTER the file upload has successfully completed.

I was looking at the "On After Transfer" in combination with the touch command as I thought this might meet our requirements. In order for this to work though you would need some way to access the filename of the file that was just uploaded. Typically you would use a macro like %MessageID% or %DateTime% which at runtime helps determines the name of the file. It could be that the use of the "On After Transfer" option is not suited to our requirment for this reason?

Regards,

Gary
#18819
Posted: 01/25/2012 07:25:50
by Ken Ivanov (EldoS Corp.)

Oops, I believed I have confirmed that all the commands do support Macros in my previous message - seems that I've just pushed "Reply" too early ;). Actually, all the command scripts you assign to the custom event handlers can contain macros - so in your particular case the command will look like the one below:

Code
<commands>
  <command type="sftp" value="touch" file="%MessageID%.CDY" />
</commands>
#18820
Posted: 01/25/2012 07:45:01
by Pdaalmeyer  (Basic support level)
Joined: 01/24/2012
Posts: 8

Hi Innokentiy,

Where can I find more information about custom event handlers and how they work with the SFTP adapter?

Cheers,

Gary
#18822
Posted: 01/25/2012 10:09:44
by Ken Ivanov (EldoS Corp.)

There is no such information available yet, sorry. Still, you can ask all the questions here, and we will provide you with detailed answers.

Event handlers expect the user to assign them with a list of commands in form of so-called command scripts. A command script is a simple XML file of the following syntax:

Code
<commands>
  <command type="<command-type>" value="<command>" ...command-parameters... />
  <command type="<command-type>" value="<command>" ...command-parameters... />
  ...
  <command type="<command-type>" value="<command>" ...command-parameters... />
</commands>


<Command-type> in the command scripts passed to the SFTP adapter should always be "sftp". <Command-parameters> depend on the exact command being requested; the "touch" command will expect a single "file" parameter containing a name of the file to create:

Code
<commands>
  <command type="sftp" value="touch" file="%MessageID%.CDY" />
</commands>
#18872
Posted: 01/31/2012 09:17:36
by Ken Ivanov (EldoS Corp.)

JFYI: BizCrypto 9.1.214 has been released yesterday night and is available for download on the web site. It introduces support for the "touch" command.
#18887
Posted: 02/01/2012 06:26:56
by Pdaalmeyer  (Basic support level)
Joined: 01/24/2012
Posts: 8

Hi Innokentiy,

Thanks so much for the quick turn around on this :-) I will download the latest version and let you know how I get on.

Regards,

Gary
Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.

Reply

Statistics

Topic viewed 14252 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!