Search This Blog

Thursday 26 May 2011

Sending Flat File over AS2 - A Practical Guide

This article focuses on how to send a flat file message from BizTalk to the Trading Partners using AS2 .

I am going point-blank to focus mainly on the steps rather than the concepts.

Ingredients required from the Sender:

- BizTalk Server 2010 with EDI/AS2 Runtime configured - we need this to send and receive messages(inc EDI) using AS2

- Signing (Signature verification) certificate - we need this for the sender to sign the message and receiver to verify the signature. The public key part of the certificate should be shared/configured at the receiver end.

- AS2 ID - any unique ID specific to the sender . This should be shared to the receiver.


Ingredients required from the Receiver:

- an AS2 software  - to receive& process AS2 message/send MDN to the sender.

- Encryption certificate - public part will be shared with the sender.

- AS2 ID - any unique ID specific to the receiver.This should be shared to the sender.

- an HTTPS site , to receive the AS2 message , the sender will the HTTPS URL to send the AS2 message .

In common , the server IPs from both sender and receiver should be firewall configured to allow the network traffic.

 BizTalk supports RC2 and DES3 encryption algorithms by default.

Assuming that the Flat flat is already available from the biztalk orchestrations /pipelines , it is time to set up the Trading partners and AS2 details to send the flat file message.

Create Parties & Send Ports

- create a send port (2-way if MDN is expected) with HTTP ,configuring the HTTPS url provided by the receiver.for ex (https://abc.com/welcome/toas2). There are few things to note while configuring the HTTPS adapter , such as configuring the certicate and thumbprint so on.

Please refer to the below url on configuring HTTPS adapter.

- create a new Party for the sender from the BizTalk Admin console ,with a name (ex: ABCLTD) and make sure to tick the box for "Local BizTalk processes messages received by the party or supports sending messages from the party" - This tells that the sender party is using BizTalk for sending messages to other parties.

- Similarly create a new Party for the Receiver (ex: XYZLTD).

Creating the parties ,also creates a profile for each party ,which we will use to create new Agreement between the 2 parties.

- Create a Agreement by right clicking on the sender party's (ABCLTD) profile, this will bring up the Agreement properties dialog box.

- You can specify a name for the agreement such as AS2_ABC_XYZ

-  Select the Protocol as AS2, from the drop down.

- on the second party (the receiver), select the XYZLTD party created earlier.

- on the ABCLTD ->XYZLTD tab, provide the AS2 ID for the sender and receiver into AS2-From and AS2-To respectively.

- on the validation ,tick "Message should be signed" & "Message should be encrypted" with the encryption algorithm either as RC2 or DES3 as agreed between the 2 parties.

- on the Acknowledgement (MDNs) , tick "Request MDN"  & "Process inbound MDN into MessageBox for routing/delivery options", if you wish to receive MDN back from the receiver.Also, on the Disposition-Notification-To box , enter any value ,even meaningless (not sure y this is been made as mandatory !?!) .The MDN received will go directly into messagebox ,so that any other send port can be used to subscribe to that.

- on the Send Ports , select the Send port created at the begining ,which will be used to send the flat file message to the receiver,via the https url.

- on the XYZLTD -> ABCLTD tab, provide the AS2 ID for the sender and receiver into AS2-From and AS2-To respectively.

- on the Validation, tick "use agreement settings for validation and MDN instead of message header",
"message should be signed" &  "message should be encrypted" along with RC2 or DES3 for the algorithm.

So by now , we have set up the Parties , user profile and the AS2 agreement between them .

Once the Biztalk application is deployed with the orchestrations and pipelines (to send a flat file , we need to have a custom flat file assembler with AS2 encoder ), we can conclude that it is ready for testing.

This article provides at the very basic level ,with much more details on working with AS2 from BizTalk and hope that this will be a starting point for anyone ,who would struggle to set up AS2 within BizTalk.

Regards

Sullu