How can I use, parse, manipulate, or evaluate a ACK response?

0 votes
asked Aug 19, 2016 by gary-t-8719 (14,860 points)
I am sending data to a down stream application and I need to parse the acknowledgement response to determine if the message was sent successfully or not. How is this done?

1 Answer

+1 vote

In the example below we will be sending an HL7 message to a downstream application with "Wait For ACK" messages enabled. The first thing to keep in mind with the ACK Script is that the ACK script must return either true, false, or an error.


1. If I don't know what is being returned or I need to parse the ACK message. I would simply put into my ACK script return true;

I can then see the ACK message in one of the following ways:

   a. If my channel is in debug mode I would be able to see a copy of the ACK message from the Status tab and double clicking on the ACK received log entry will open the ACK message into a larger window.

   b. Open the Message Detail window from the Messages, Error, Completed tabs and then double click on a message and then click on the Response Received tab.


2. Now that I have a copy of my ACK message it can be added on the Source Node as a Sample Message for node path lookups.

3. The next thing to keep in mind is that a copy of the ACK message is automatically saved into a variable name called response. The response can be parsed into a message object using one of the QIE Parse String functions like:

var ackMessage = qie.parseHL7String(response);
var ackMessage = qie.parseXMLString(response);

By parsing the response as one of the given message object types the user can then use any of the Code Wizard -> Message functions on the response object by simply replacing "message." with "response." or in our example "ackMessage." For example instead of:

   var ackId = message.getNode('MSA-2'); you would use var ackId = ackMessage.getNode('MSA-2');

4. After parsing the response and get to the relevant data that indicates whether the message was successfully sent the ACK script can return either true, false or an error to handle the completing of the message sending (return true), resending the message(qie.simulateSendError or qie.throwSendError), or generating an error(return false or response.error(msg)).



answered Aug 19, 2016 by gary-t-8719 (14,860 points)
edited Aug 19, 2016 by gary-t-8719