Sidebar

How do I process an XML ACK messages on the destination node?

0 votes
2.2K views
asked Dec 11, 2013 by gary-t-8719 (14,860 points)
edited Dec 17, 2013 by gary-t-8719

1 Answer

0 votes

There are three things to keep in mind when processing an ACK message of any type (XML, HL7, CSV, et cetera).

1. QIE stores the ACK message in a variable named "response"

2. The ACK or value stored in the response variable is a string value.

3. After evaluating the response the ACK script should return a Boolean value (true or false, or a 1 or 0). If a non-boolean value is passed then it will always be evaluated as a successful response.

The first step to processing an ACK message is to obtain a sample. This can easily be done by just putting return; in the script window and then playing some message through the channel to the destination. The ACK returned by the receiving system will be stored as the "Message Result" and can be seen from within the Message Detail window.

The second step is to save a copy of the ACK response as a Sample Messages.

The third step is to determine what level validation is needed for your interface requirements. There are two basic levels of validation. The first simply validates that a response was received and the second validates the content of the response.

1. Validates that the message was sent and received by the destination. This level of validation simply checks that an ACK message has been received by QIE. In the example script below you can see that the only check made is that the response is not null or empty.

return StringUtils.isNotBlank(response) 

2. Validates the content of the response to ensure that the receiving system did not send back any error codes. With this type we first convert the response string to an XML message model object. Then we use XPATH to get the value of a particular element to evaluate the ACK success.

Example xds.b response:

<?xml version='1.0' encoding='UTF-8'?>

<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">

    <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">

        <wsa:Action soapenv:mustUnderstand="true">urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-bResponse</wsa:Action>

        <wsa:RelatesTo>urn:uuid:AD33D8190CB655E8751247750894152</wsa:RelatesTo>

    </soapenv:Header>

    <soapenv:Body>

        <rs:RegistryResponse xmlns:rs="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"

            status="urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success"/>

    </soapenv:Body>

</soapenv:Envelope>

Example ACK script code to evaluate the above response:

if (StringUtils.isBlank(response)) {

   return false;

}

 

var ackMessage = qie.parseXMLString(response);

var ackValue =  ackMessage.getNode('//RegistryResponse');

//Returns a boolean value based on the response containing Success or Failure

return StringUtils.containsIgnoreCase(ackValue, 'Success');

 

See also How do ACK (Message Acknowledgment) scripts work in QIE

answered Nov 5, 2014 by gary-t-8719 (14,860 points)
edited Nov 5, 2014 by gary-t-8719
...