Segregating Files Received From Different AS2 Trading Partners

Updated by John Carl Villanueva on

Files coming in via unauthenticated AS2 file transfers are stored in one common directory. However, in most cases, you would like to segregate files according to their sending trading partner. This post will teach you how to set up MFT Server for that. 

It's easy to segregate files when they're uploaded to your server via authenticated AS2 file transfers. In fact, you don't have to do anything in this case because the uploaded files will simply be stored into the directory of a user account who will most likely be associated with the sending trading partner. Let me elaborate on that a bit in case you found that confusing.

Authenticated vs Unauthenticated AS2 transfers

When trading partners wish to connect to JSCAPE MFT Server's AS2 service, they have the option to authenticate using user account credentials or not. When a trading partner authenticates using user account credentials, we call that an authenticated transfer. Those that don't authenticate with user account credentials are called unauthenticated transfers.

To illustrate, if the sending AS2 trading partner was also a JSCAPE MFT Server instance and it wished to perform an authenticated transfer with your MFT Server, its trading partner settings would typically include values in the username and password fields.


authenticated as2 transfers

To clarify, that doesn't mean unauthenticated transfers don't employ any form of authentication. They still do. They can still authenticate through digital certificates (see article 'Taking Advantage of SSL/TLS Security When Running AS2 On HTTPS'). 

Segregating files of trading partners using authenticated transfers

One advantage of using authenticated transfers is that it's easier to segregate inbound files according to their sending AS2 trading partners. That's because each trading partner that connects via an authenticated transfer will likely already be associated with an existing user account whose username and password were used during authentication. Thus, when those trading partners upload files, those files will be automatically stored in their respective user account directories. 



For unauthenticated transfers, it's not that straightforward.

Segregating files of trading partners using unauthenticated transfers

When files are uploaded via unauthenticated AS2 transfers, all those files are stored in one common directory




And that directory belongs to the user account specified in the 'Bind unauthenticated transfers...' setting in Settings > Web > AS2


bind unauthenticated transfers to user


Since all uploaded files will be stored in one common directory, you need to do a few additional steps if you want to segregate those files according to sending trading partners. But don't worry. There's nothing to it. Basically, all you need to do is create a trigger that uses the File Upload trigger event and then you have two options:

Option 1:

You can specify a trigger condition similar to this:

AS2.Sender = "trading_partner_id"

Just replace trading_partner_id with the actual AS2 trading partner ID of the sending trading partner. With this condition, you could then have an action that moves the file to the desired directory using Move File action. Note, however, that you would need a separate trigger for each trading partner. 

Option 2: 

Alternatively, you could do away with having a condition altogether and just use the AS2.Sender variable as part of your Move File action as follows:

File: %LocalPath%
Destination Directory: C:\path\to\root\%AS2.Sender%

The result is that files would automatically be moved to a unique directory for each trading partner.


Would you like to try this out yourself? Download the free, fully-functional Starter Edition of JSCAPE MFT Server now. 


Download JSCAPE MFT Server

Download Now 


Want to be updated on posts like this? Connect with us...



Topics: JSCAPE MFT, Managed File Transfer, Business Process Automation, Triggers, AS2