Sidebar

How can I configure a ProviderAndRegisterDocumentSet endpoint to listen for incoming messages ?

0 votes
624 views
asked Apr 27, 2018 by (120 points)

1 Answer

0 votes

You need to configure your channel source with Format: XML and Source: HTTP Listener.

In the first mapping you will need to extract the soap envelope from the message. This is due to the HTTP listener including all the metadata from the http request in the source message xml.

Here is the code:

if ('binary' === message.getNode('/Request/Part/content-transfer-encoding') + '') {
   message = qie.createXMLMessage(qie.base64Decode(source.getNode('/Request/Part/Content').trim()).replaceAll("soapenv:", "").replaceAll("wsa:", "").replaceAll("query:", "").replaceAll("rim:", "").replaceAll("ihe:", "").replaceAll("lcm:", "").replaceAll("xop:", "").replaceAll("retrieve:", ""));
   message.formatXML(3);
} else {
   message = qie.createXMLMessage(source.getNode('/Request/Part/Content').trim().replaceAll("soapenv:", "").replaceAll("wsa:", "").replaceAll("query:", "").replaceAll("rim:", "").replaceAll("ihe:", "").replaceAll("lcm:", "").replaceAll("xop:", "").replaceAll("retrieve:", ""));
   message.formatXML(3);
}

Now that you have the soap envelope as your message, you can use the data and access the PNR soap envelope as well as any included documents . You will then need to reply to the request using qie.postMessageResponse.

Here is an example of a successful reply:

// either get the patient id from the envelope or the CCD.
messageCache.setValue('PID', message.getNode('/Envelope/Body/ProvideAndRegisterDocumentSetRequest/SubmitObjectsRequest/RegistryObjectList/ExtrinsicObject/Slot[@name="sourcePatientId"]/ValueList/Value'));
var response = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
   "<soapenv:Envelope xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\n" +
   "  <soapenv:Header>\n" +
   "    <wsa:Action>urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-bResponse</wsa:Action>\n" +
   "    <wsa:RelatesTo>" + message.getNode('/Envelope/Header/MessageID') + "</wsa:RelatesTo>\n" +
   "  </soapenv:Header>\n" +
   "  <soapenv:Body>\n" +
   "    <rs:RegistryResponse xmlns:rs=\"urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0\" status=\"urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success\"/>\n" +
   "  </soapenv:Body>\n" +
   "</soapenv:Envelope>";
qie.postMessageResponse(response.toString());
message.setNode('/', response);

Please note Qvera does sell a Virtual HIE package that can import this document into an EMR as well as handle pix and retrieveDocument requests from a partner in addition to receiving a PNR request.

answered Apr 27, 2018 by brandon-w-8204 (33,270 points)
...