Simple Mirth Channel – HL7 v2 mapped to a WSDL / Web Service Call

In this follow up to our first Mirth Connect Blog Post, we look at how to take a fairly common HL7 v2 message and map it to a custom Web Service interface.  In many real world cases, we have to do this when we want to connect to a HIE, EMPI, Data Warehouse or Data Repository.  This use case shows how it is fairly simple to extract the patient demographics from an ADT A01 (Admission) and build a custom XML structure for the WS call.

Channel 1:

  • Source: TCP/IP Listener which is intended to receive data from an originating source system.
  • Destination: WS Sender to Channel 2 URL (which is intended to simulate an EMPI, DW, CDR, etc)
  • Destination Transformer: HL7 V2 > WSDL

Channel 2:

  • Source: WS Listener
  • Destination: Generic Channel Output (do nothing)

You can download both completed channels and a sample message here:  HL7 V2 to Web Service WSDL.zip

Following are the steps to create these two channels:

Creation of WSDL – R

1.    First of all, we
need to create the receiver, which is “WSDL – R” here. Creating receiver first
is important since while creating the sender, we will need the wsdl/url/api of the
receiver.

a.    Click on
channels.
ClickOnChannels.PNG

b.    Click on New
channel.
ClickOnNewChannels.PNG

c.     Provide a
name for the channel and set the data types.
ProvideAName.PNG

d.    Select the Web
Service Listener as Source Connector type.
Connector.PNG
The highlighted part in the image above has the WSDL URL which we will have to
use while creating the sender.

2.    Add one
transformer step.This transformer will display the received message.

a.    Click on Edit
Transformer.
ClickOnTransformer.PNG

b.    “logger.info(connectorMessage.getRawData())”
is the only line that we need to add under JavaScript step.

3.    Third step is to
configure the destination of the receiver channel, i.e WSDL – R. So far, we
configured the source and we created one simple transformer.

a.    Click on
Destination Tab and select Channel Writer

.

4.    Final step is to
Save and Deploy the channel. Click on save and click on deploy.
SaveAndDeploy.PNG

Creation of WSDL – S:

1.    Click on new
Channel.

2.    Provide a name
for the channel and set the data types.

3.    Select the TCP
Listener as Source Connector type.

4.    Click on
Transformer, add a JavaScript step. Here, we map HL7v2 message to an xml. We
need to provide a sample HL7v2 message as an incoming message template and a
sample xml message as an outgoing message template.
The complete transformer message is put into a variable called “sendMe”.

5.    Click on
Destination and select Web Service Sender from the drop down.
WebSender.PNG
Once you select Web Service Sender from the drop down menu, under Web Service
Sender Settings, we need to provide the WSDL URL of the receiver(This value
comes from the source screen of WSDL – R channel that we created already).
After providing the WSDL URL, click on “Get Operations” button, values for
Service, Port/Endpoint, Location URI will be populated automatically.

6.    On the same
screen, click on Generate Envelope, this generates a SOAP Envelope.

We need to drag <![CDATA[]]> from
the bottom right part of the screen and within the angular brackets, we need to
put ${sendMe} , this value also comes
from the same pane from where CDATA comes. And once we put “sendMe” within
CDATA, we need to put CDATA within the open and close tags of arg0.

 

7.    Final step is to
Save and Deploy the channel.

 

 

How to send a message from WSDL
– S to WSDL – R?

1.    Dashboard:
Select the channel, click on send message.
SendMessage.PNG

2.    Put the message
in the popup window and click on process message button.
ProcessMessage.PNG

3.    Under server log
tab, you will see the sent message being displayed. This message is coming from
the WSDL – R.

You may also click on it and see the full message.