0

I am trying to get the string representation of the HL7 message input to a channel. Documentation says

var myMessage = connectorMessage.getRawData()

should give me the original unparsed HL7 message. However the type of the data returned is an object and not a string. I tried using .toString() but that doesn't work either. My javascript library code that expects a string and be able to split it fails because what's returned is not a string.

How do I get the original HL7 message string?

rams
  • 6,381
  • 8
  • 46
  • 65

2 Answers2

1

connectorMessage.getRawData() returns a Java string rather than a javascript string. You can convert to a javascript string by doing.

var myMessage = String(connectorMessage.getRawData())

This is true no matter what you have selected for your data type.

agermano
  • 1,679
  • 6
  • 16
0

On the Summary tab, click on "set data types", and change your inbound connector to "Raw"....after this, connectorMessage.getRawData() should return to you a long string that is the incoming message.

Gavin Perkins
  • 685
  • 1
  • 9
  • 28
  • 1
    Changing the data type does not affect what is returned by `connectorMessage.getRawData()`. The difference when you change the data type to Raw is that `msg` will hold a javascript string equivalent to the java String that `connectorMessage.getRawData()` returns. However, this also means the inbound hl7 message will no longer be serialized to xml and converted to an object for you, and that must be done manually if you still need to access parts of the HL7 message. – agermano Sep 17 '20 at 18:37