HL7 Message Validation

The HL7 connector is part of the Mule Healthcare Toolkit, which also includes transformers and components for receiving, processing, and sending HL7 messages. For details and a full list of available tools, consult the Toolkit’s documentation main page.


The Mule Healthcare toolkit allows you to configure validation for HL7 messages. You can set validation parameters in the HL7 connector, as well as several HL7 message processors. For the complete list of message processors that support validation, see Supported Tools.

The validation setting can have one of three values, described in the table below.

Setting Description


No validation


Checks that the message is well-formed


Checks that message is well-formed, and that all structural elements of the message are present

Supported Tools

The table below lists the tools in the HL7 toolkit that support validation.

Tool Validation Remarks

HL7 Connector


When defined in a global HL7 connector, Mule implements validation only for those HL7 endpoints that reference the connector. If no HL7 endpoints reference the connector, Mule automatically applies validation in all HL7 endpoints in the application.

HL7 Endpoint


An HL7 endpoint applies validation when it references an HL7 connector where validation has been configured (see the Using Validation). The HL7 endpoint itself has no configuration settings for validation.

HL7 Encoding Transformer


HL7 ACK Component


HL7 Append Segment


HL7 Delete Segment


HL7 Message Component


Using Validation

You can set validation for specific message processors only, or for a whole application.

If you set validation only in specific message processors, Mule only applies validation to those message processors. If you define validation at an HL7 connector, Mule only applies validation to the HL7 endpoints which reference that connector. If no HL7 endpoints reference the HL7 connector, then Mule applies validation at all HL7 endpoints in the application.

Combining these configurations with the validation setting (WEAK or STRONG) allows you to use validation beyond the simple case of rejecting an invalid HL7 message. For example, you can reject HL7 messages using strong validation but still perform logging or preliminary business logic on them.

Flow 1:

  • An HL7 Endpoint receives incoming HL7 messages. This endpoint references HL7 Connector 1, which applies weak validation. If the incoming messages passes validation, the endpoint forwards it to the next message processor.

  • A Variable Transformer defines variables for logging.

  • A Logger Component performs logging.

  • A Flow Ref Component invokes the next flow.

  • An HL7 ACK Component sends an ACK message back to the originating application.

Flow 2:

  • An HL7 endpoint receives the message sent by Flow 1. This endpoint references HL7 Connector 2, which applies strong validation. If the message passes validation, the endpoint forwards it to the main logic in the flow.

If this example application receives an HL7 message that is not valid for its main logic, the application rejects the message, but still logs relevant information about it.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub