Determine incoming message format with Azure Function
When receiving an AS2 message from a third party, you are not always sure what format you are receiving (X12, EDIFACT, XML, Flat File, ...) Specially if you are working with an external EDI service for X400 (like GXS, EDICOM, ...) BizTalk When you use the EDI Disassembler component in a receive location, it determines if you are receiving an EDIFACT or an X12 message. The way it does that is quite easy actually. It looks at the 3 first characters of the message body. ISA = X12 UNA or UNB = EDIFACT In any other case it will throw an error. Logic Apps In Logic Apps, the components for EDIFACT and X12 are not combined in common "EDI" compontens. So we need a way to determine this ourselves in order to use the correct components. To make it fully generic, I also included the option to receive XML and custom Flat File messages. using System.Net; using System.Text.RegularExpressions; public static async Task Run(HttpRequestMessage req, TraceWriter log) { log.I...