Http post to mirth connect with HL7 in the body

636 Views Asked by At

I am currently facing an issue while sending an HTTP message to my Mirth Connect server. I have placed an HL7 message in the raw text format inside the request body. Here's an example of the request sent from Postman:

Content-Type: application/hl7-v2+er7
Body Content Example:
MSH|^~\&|APP|FAC^12345|YOU|YOU|20130114081000||ORU^R01|20130114081000|T|2.5.1|

I have set up an HTTP listener in the source connector of my Mirth Connect channel, configured as shown in the following image. So the response for this would be as 'destination 1'.

enter image description here

However, when I attempt to access the HL7 message in the destination connector using the connectorMessage.getRawData() method, I receive the entire XML content instead of the desired HTTP body text.

Here is the code snippet I tried in the destination connector:


// Get the HL7 message from the connectorMessage object
var hl7Message = String(connectorMessage.getRawData());

Could you please help me understand what I might be doing wrong in this scenario?

Thank you in advance for your assistance.

1

There are 1 best solutions below

0
avielbl On

Have you tried through javascript in a transformer to just get relevant fields from the message as in:

var hl7Content = msg['PID']['PID.5']['PID.5.1'].toString();