Skip to content
LambogeniusDocs

HL7 v2 Codec for Azure Logic Apps

Encode HL7 message

Turn the XML document or its JSON form back into ER7, with optional validation.

Service provider/serviceProviders/lamboHl7CodecLicensed together with the HL7 MLLP Connector. One token covers both.

Inputs and output

InputDefaultMeaning
message(required)The XML document, or its JSON form.
inputFormatautoauto (JSON when the input starts with {), xml or json.
validateXmltrueValidate against the XSD before encoding.
segmentTerminatorCRCR, LF or CRLF.
wrapInMllpfalseAdd MLLP framing.
schemaName, schemaFolder, allowUndefinedContentAs for Decode.

Output: success, hl7Message and errors.

Example: a mapped ORU to ER7

"Encode_HL7": {
  "type": "ServiceProvider",
  "inputs": {
    "parameters": {
      "message": "@{outputs('Transform_to_ORU')}",
      "validateXml": true
    },
    "serviceProviderConfiguration": {
      "connectionName": "lamboHl7Codec",
      "operationId": "encode",
      "serviceProviderId": "/serviceProviders/lamboHl7Codec"
    }
  }
}
  • Delimiters come from MSH-1 and MSH-2 in the document.
  • Positions come from the schema, looked up by the root element name (or schemaName). Without a schema and without validation, positions come from the element names.
  • Groups are flattened, and trailing empty fields and components are trimmed.
  • Extensions round-trip: content the XSD doesn't define (Z-segments, extra fields, components, repetitions) is left out of validation and encoded unchanged, so decoded messages can be encoded again.

To send the result over MLLP, pass body('Encode_HL7')?['hl7Message'] to the MLLP Connector's Send message.