This is a C# source code that generates an unencrypted AS2 message with no request for an MDN. The complete program
can be downloaded at EDIINT AS2.
A detailed explanation of the algorithm can be read at "Creating
an AS2 client in stages".
private void btnPlain_Click(object sender, EventArgs e) { ediDocument oEdiDoc = null; mailDocument oMailDoc = null; mailMessage oMailSubject = null; oEdiDoc = new ediDocument(); //object for AS2 file oMailDoc = oEdiDoc.GetMailDocument(); //oject for subject/content in AS2 file oMailSubject = oMailDoc.GetMessageContent(); //Create headers in the order you want them displayed // Put globally unique ID as Message-ID. oMailSubject.set_HeaderFieldValue("Message-ID", "1234567890@evalusercompany.com"); //txtMessageID.Text // Put AS2 version. oMailSubject.set_HeaderFieldValue("AS2-Version", "1.0"); // Put AS2-To header value. oMailSubject.set_HeaderFieldValue("AS2-To", "ToCompanyABC"); // Put AS2-From header value. oMailSubject.set_HeaderFieldValue("AS2-From", "FromCompanyXYZ"); //add appropriate header to describe the content // - "Application/EDI-X12" for EDI X12 // - "Application/EDIFACT" for EDI UN/EDIFACT // - "Application/XML" for XML oMailSubject.set_HeaderFieldValue("Content-Type", "Application/EDI-X12"); //the content that we want to send in this AS2 message is an EDI X12 file. The file is imported into the message object. oMailSubject.Import(sPath + "ediFile.X12"); //The AS2 document is constructed at this time, and the file is created. This is the file you would send by http or https oMailDoc.Save(sPath + @"\MailFolder\AS2PlainText.bin"); //Send file by http TransmitFileByHttp(ref oMailDoc, "AS2PlainText.bin"); oMailSubject.Dispose(); oMailDoc.Dispose(); oEdiDoc.Dispose(); MessageBox.Show("Done"); }