web-serviceshl7mirth-connect

Mirth Connect custom ACK


I've just entered in the Mirth Connect world.

I've some problem to generate a custom ACK for my applications.

Here how it must to work:

The channel must to receive HL7 v2 message, it transforms message, and sends it to 3 destinations:

1. File writer -> it write base64 file into a file

2. Database writer -> it write in my table the reference of the files, with other data.

3. Webservice writer -> it send some other data to a soap server, and get a response.

Step 1, 2, and 3 works... but at the end of the 3rd step, I must to collect some response data of the Webservice, and i must to create a custom Hl7 ACK for send back to the source.

I don't know how to read response from 3rd destination and create hl7 ack to send back to the source.

Can somebody help me in this!?

Thanks.


Solution

  • Here the solution:

    I get every source data with:

    message.getConnectorMessages().get(0).getRawData();
    

    I convert it in XML.

    Later, i create a new Hl7 Message

    var new hl7 = new XML("<HL7Message/>");
    

    and I append all the childnodes and i use some values from source xml.

    At the end, I convert "hl7" variable in HL7, and I put it on the ResponseMap...

    All this one in the PostProcessor, and I select this one as ACK in the source tab.