Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Testing with HAPI TestPanel

HAPI TestPanel is an HL7 receiver, transmitter and message editor. It is free software distributed under the MPL/GPL licenses, and runs on Mac OSX, Linux and Windows.

Since HAPI TestPanel can transmit HL7 messages to a listening application, you can use it to test your Mule flows which handle HL7. The following section provides an example of a simple flow tested with HAPI TestPanel.

Simple Example

In this example, you can:

  • Build a simple Studio application to process the HL7 messages, then send responses

  • Configure the HAPI TestPanel application to send and receive HL7 messages on specific ports

  • Test that the setup works as intended

Configuration and Illustration

HAPI TestPanel is uses the following default Host and Port configurations:

  • To send HL7 messages – localhost, port 50609

  • To listen for HL7 messages – localhost, port 51609

The diagram below illustrates the steps the HAPI TestPanel and Mule take to process HL7 messages.

The HAPI TestPanel:

  1. Generates an HL7 message.

  2. Sends an HL7 message to the Mule application over port 50609.

  3. Receives an HL7 message.

  4. Anypoint Studio processes the HL7 message

  5. Sends an ACK reply (general acknowledge) to localhost port 51609 and transforms the original HL7 message to XML. Simultaneously, Mule stores the message on a file on the local filesystem.

  6. Receives the ACK reply.

testflow-diag

Anypoint Studio Application

This example application performs the following actions:

  • Listens for incoming HL7 messages

  • when it receives a message, it sends an HL7 ACK message to the sending application

  • Transforms the received message from ER7 to XML

  • Writes the resulting XML to a text file

sampleflow

The first building block is an HL7 inbound endpoint, configured with the following parameters:

  • Hostlocalhost

  • Port50609

After the HL7 inbound endpoint, an All Flow Control sends the HL7 message to two Cache Scopes for parallel processing.

In the Send ACK scope, an HL7 ACK Component processes the original HL7 message and generates an ACK message. Then, an HL7 outbound endpoint sends the ACK message to the originating application. The HL7 outbound endpoint has been configured with the following parameters:

  • Hostlocalhost

  • Port51609

In the To XML and file scope, the first building block, an HL7 Encoding Transformer transforms the original HL7 message from ER7 to XML, and a File Endpoint writes the output to a file (in this example, /tmp/hl7-2test).

HAPI TestPanel Configuration

This section explains how to set up HAPI TestPanel to work with this example.

HAPI TestPanel configuration involves the following tasks:

  • Configuring HAPI TestPanel to send a sample HL7 message to localhost port 50609

  • Configuring HAPI TestPanel to listen for incoming HL7 connections on localhost 51609

  • Starting the listening port

  • Sending a sample HL7 message

  • Checking the listening port’s Activity log for the ACK reply from Mule

To configure the HAPI TestPanel:

  1. In the Sending Connections pane to the right of HAPI TestPanel’s main window, click the displayed localhost connection (see the mouse cursor in the image below). The application displays the Outgoing Message Sender pane for configuring outgoing connections.

    hapi-outconf

  2. At the *Outgoing Message Sender *pane, configure the following settings (highlighted above):

    • Hostlocalhost

    • Port50609

  3. In the Receiving Connections pane to the right, click the displayed localhost connection. The application displays the Incoming Message Receiver pane, which is identical to the Outgoing Message Sender pane displayed above.

  4. At the Incoming Message Receiver pane, configure the following settings:

    • Hostlocalhost

    • Port51609

  5. Click  Start  near the top of the Incoming Message Receiver pane. HAPI TestPanel starts listening for HL7 messages on the configured host and port.

  6. Click the Messages pane to the right of the application window. The application displays a predefined sample HL7 message (see image below).

    hapi-messages

  7. Click the Send button near the top of the pane. The application sends the sample message once to the specified host and port. Mule receives the HL7 message, then returns an ACK message to HAPI TestPanel.

  8. Click the localhost connection in the Receiving Connections pane, then check the Activity log for the HL7 response from Mule. The image below displays the HL7 ACK messages sent by Mule.

    hapi-incoming-ack