When the business involves lots of confidential data, security will be a major concern for all enterprises. Therefore, going for an EDI trading platform with a secure file transfer protocol is essential. AS2 Gateway is a SaaS EDI trading platform which is created based on AS2 protocol to provide secure, reliable and faster communication for B2B enterprises. In addition to all the benefits packaged with AS2 protocol, AS2 Gateway itself provides a flexible, easy-to-use, personalized piece of software to the customers. So, in this article let’s talk about how to send AS2 messages via AS2 Gateway.
To get started with AS2 Gateway, you have to register your organization by giving few details like domain name, name, administrator’s name, email address, etc.
Once you have submitted the details, an account in AS2 Gateway will be created for your organization. When you log in, you will see a dashboard view where users can monitor the number of messages transferred within a particular period with graphical representations.
To start sending messages via AS2 Gateway, you have to create a trading station for your organization which will act as your local endpoint. To configure a station, go to ‘Stations’ UI and click ‘New Station’ button.
In Station configuration UI, provide a name to your trading station, and a unique AS2 identifier to use in messaging. Then you have to provide an email address which can also be used to get notifications for receiving messages of the station. You can also state a small description of your station.
AS2 Gateway provides 3 options to configure a certificate for the station.
Once you have submitted the form, the station will be created and will appear in ‘Stations’ UI as below.
On the station block, you can see 4 icons as below.
After configuring a station, you have to add your clients as trading partners. They will act as the receiving endpoints of your station’s outbound messages, and you can receive messages from them as well. To set up a partner, go to ‘Partners’ UI and click ‘New Partner’ button.
Give the name of your trading partner. Select your partner type; Test or Production. Then provide AS2 identifier, which will uniquely identify the trading partner you are gonna address when exchanging messages. And then you can state a small description of your partner. This will be helpful to easily identify the relevant partner if you are going to create more than one. Then provide the AS2 message receiver URL of the partner and the encryption certificate, which you have already received from them. If your partner has separate certificates for encryption and signing, you can provide the latter as well.
You can set a predefined message subject for your trading partner, which will be used if you haven’t provided a specific subject while sending a message. Then under advanced settings, you can customize AS2 message configurations like encryption, sign algorithms, and the nature of the expected MDN (receipt), specific to the trading partner.
Once you have successfully configured a station and a partner, you are ready to send messages via AS2 Gateway. You can go to the ‘Messages’ UI by the sidebar menu or just click “Send New Message” icon on the bottom right corner in any page. Then in ‘New message’ view select the relevant station and partner from the dropdown list, specify a message subject (optional), attach a document(s) and click ‘Send” button.
The message will be added to the queue and you will be redirected to the “Queued Messages” view which displays the status of the outbound message. If the message was successfully delivered to the partner, the message will be moved to the ‘Sent’ view where you can find all the necessary details of the message. After 10 automatic retries, if AS2 Gateway is unable to successfully send the queued message out, it will be moved to ‘Failed’ view where you can find its failure reason, along with other message details.
When sending/receiving a large number of documents, it’s better to use an integration mechanism like SFTP. And also, if you prefer to integrate internal systems with your trading platform, it’s a perfect choice for you to go with AS2 Gateway SFTP connectivity which you can configure to automate inbound message flow.
To set up SFTP with AS2 Gateway, go to SFTP tab from sidebar menu.
Give a valid username and password and click ‘Setup SFTP’ button.
Once the configurations are done, download the private key by clicking on the ‘Export Key’ button. The downloaded file name will be something like id_rsa_username. Navigate to the directory where it is downloaded through the terminal and execute below command (for Linux and macOS) replacing {private_key_file} with your private key file name to set correct permissions to the file.
chmod 400 {private_key_file}
Then, to login to the AS2 Gateway SFTP server, run below command; replacing {private_key_file}
and {sftp_username}
with your own.
sftp -P 9193 -i {private_key_file} {sftp_username}@sftp.as2gateway.com
Once you have run the above command, it will ask to enter passphrase; which is the password you have given when setting up SFTP. After that, you can successfully connect to the AS2 Gateway’s SFTP server. There you can see a directory named as as2gateway and private and public keys of your SFTP user. In the as2gateway directory, you will find directories being created for each station which are associated with your organization. Each of these directory labels are created under the unique AS2 identifier assigned to the respective station. In each station directory, you will find directories being created for each partner AS2 identifier associated with your organization.
To send documents from AS2 Gateway, transfer your documents via SFTP to the following SFTP path.
If partner type is Production | as2gateway/(AS2-Station-ID)/(AS2-Partner-ID)/outbox |
If partner type is Test | as2gateway/(AS2-Station-ID)/(AS2-Partner-ID)/test/outbox |
When sending a multi-document message via SFTP you have to create a folder inside the outbox [as2gateway/(AS2-Station-ID)/(AS2-Partner-ID)/outbox/ or as2gateway/(AS2-Station-ID)/(AS2-Partner-ID)/test/outbox/ ] directory and upload your documents to the newly created folder. 2 minutes after the last file is uploaded, AS2 Gateway will pick up and send all files as one message to the relevant trading partner.
You can download the receiving files via SFTP through the following SFTP path.
If partner type is Production | as2gateway/(AS2-Station-ID)/(AS2-Partner-ID)/inbox |
If partner type is Test | as2gateway/(AS2-Station-ID)/(AS2-Partner-ID)/test/inbox |
In inbox directory, all incoming messages will be either separated into subdirectories based on the received timestamp or saved directly in inbox directory with timestamp prefixes – according to the user preference.
AS2 Gateway is an EDI trading platform which was dedicatedly built to reduce underlying complexities of AS2 protocol and build a secure, reliable and faster communication network among B2B enterprises. It provides a variety of customizations when sending/receiving AS2 messages and allows faster integrations with existing internal systems.
Kumudika is the Senior QA Lead at Aayu Technologies, bringing over six years of industry experience. She has a keen eye for detail and committed to delivering high-quality software products. When not testing, Kumudika loves watching sitcoms, enjoying good food, and catching up on sleep—just like a bear in hibernation.