One document per message, MSH included
BizTalk's HL7 disassembler produces two XML documents per message: one for the MSH header and one for the body. The codec produces one document, with MSH as the first child of the message root, validated against one XSD that defines both. The body segments follow as its siblings. Maps, XPath and expressions see the whole message in one place. There is no separate header document. For this message:
MSH|^~\&|HOSPITAL|FACILITY|TARGET|FACILITY|20261021120000||ADT^A01^ADT_A01|MSG00001|T|2.5
EVN|A01|20261021120000
PID|1||123456||DOE^JOHN||19800115|M
PV1|1|IDecode returns this document in body('Decode_HL7')?['xml'] (shortened with …):
<ns0:ADT_A01_25 xmlns:ns0="http://lambogenius.com/HealthCare/HL7/2X">
<MSH>
<MSH_1_FieldSeparator>|</MSH_1_FieldSeparator>
<MSH_2_EncodingCharacters>^~\&</MSH_2_EncodingCharacters>
<MSH_3_SendingApplication><HD_0_NamespaceId>HOSPITAL</HD_0_NamespaceId></MSH_3_SendingApplication>
…
<MSH_9_MessageType>
<CM_MSG_0_MessageType>ADT</CM_MSG_0_MessageType>
<CM_MSG_1_TriggerEvent>A01</CM_MSG_1_TriggerEvent>
<CM_MSG_2_MessageStructure>ADT_A01</CM_MSG_2_MessageStructure>
</MSH_9_MessageType>
<MSH_10_MessageControlId>MSG00001</MSH_10_MessageControlId>
<MSH_11_ProcessingId><PT_0_ProcessingId>T</PT_0_ProcessingId></MSH_11_ProcessingId>
<MSH_12_VersionId><VID_0_VersionId>2.5</VID_0_VersionId></MSH_12_VersionId>
</MSH>
<EVN_EventType>…</EVN_EventType>
<PID_PatientIdentification>
<PID_1_SetIdPid>1</PID_1_SetIdPid>
<PID_3_PatientIdentifierList><CX_0_IdNumber>123456</CX_0_IdNumber></PID_3_PatientIdentifierList>
<PID_5_PatientName>
<XPN_0_FamilyName><XPN_0_0_Surname>DOE</XPN_0_0_Surname></XPN_0_FamilyName>
<XPN_1_GivenName>JOHN</XPN_1_GivenName>
</PID_5_PatientName>
…
</PID_PatientIdentification>
<PV1_PatientVisit>…</PV1_PatientVisit>
</ns0:ADT_A01_25>The element names and the namespace come from your XSD. This one is ADT_A01_25 from the HL7 v2 Schema Generator. Decode also copies the main MSH values (control ID, message type, version, sender, receiver) into summary properties, and builds the ACK from MSH.
Compared with Microsoft's Decode HL7
| HL7 v2 Codec | Logic Apps Decode HL7 (Microsoft) | |
|---|---|---|
| MSH | Inside the one document, and copied into summary properties | A separate header, as in BizTalk |
| Output | XML or JSON | XML |
| Schemas | XSDs in the Logic App's Artifacts/Schemas | An integration account with the message schemas |
| ACKs | Decode generates them (original or enhanced), plus a Create acknowledgement action | Not generated |
The Microsoft column is from its documentation, Integrate healthcare systems with HL7 and MLLP (September 2026).
The actions
| Action | Operation ID | What it does |
|---|---|---|
| Decode HL7 message | decode | ER7 (pipe-delimited HL7) → XML or JSON, with validation and the ACK/NAK. Handles batches. |
| Encode HL7 message | encode | XML or JSON → ER7, with optional validation. |
| Create HL7 acknowledgement | createAck | Builds an ACK for a message, for example an application ACK after processing. |
Where it runs
- Logic Apps Standard, as a built-in connector (installed as a NuGet package): Workflow Standard plans on App Service, hybrid deployment, and containers. The actions appear in the designer under Built-in.
- Any trigger: HTTP, Service Bus, Blob, or the HL7 MLLP Connector to receive and send over MLLP.
- Your schemas: XSDs in the Logic App's
Artifacts/Schemas. No integration account.