Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Parse HL7 Content from JSON Request into EnsLib.HL7.Message Object

Question
Craig Regester · Sep 30, 2019

Parse HL7 Content from JSON Request into EnsLib.HL7.Message Object

Good morning -

I am attempting to pass some HL7 content (say, a complete ADT message) from one server to another via REST/JSON - for reasons. 

I can get the data across but when I try to create an EnsLib.HL7.Message object from the message in the JSON body, I end up with just the start of an HL7 msg in the resulting object. Looks like: MSH|^~\&

The start of the code accepting the data looks like this:

S tReq = {}.%FromJSON(%request.Content.Read())
S tInput = tReq.Message

S tMsg = ##class(EnsLib.HL7.Message).%New()
D tMsg.ImportFromString(tInput)
S tMsg.DocType = "2.3.1:ADT_A01"

So now if I take that tMsg and try to send it to an Adapterless Business Service and/or simply try to output what it receives to a file, I get basically nothing. I've tried multiple methods to get the string HL7 Content (from the JSON body) into the EnsLib.HL7.Message object to no avail. I feel like I'm missing something quite simple so tossing this out there in hopes I can move past this on to better things. Thanks,

Craig R

#API #HL7 #JSON #Ensemble

Source URL:https://community.intersystems.com/post/parse-hl7-content-json-request-enslibhl7message-object