Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Get Destination Response with Postprocessor (http://www.mirthcorp.com/community/forums/showthread.php?t=218129)

pacitommaso 03-30-2018 01:14 PM

Get Destination Response with Postprocessor
Hello Everybody.
I have a Mirth Channel with multiple Destinations (HTTPSender) and each Destination can return me a Response such as this one:

"Response" : {
"responseCode" : "10020",
"responseDesc" : "Patient Data Updated",
"eccc" : "6f077bf9-66dd-92fb12400938"

I'm trying to get the content of this message, and as I have multiple destinations I need to parse the response using a Postprocessor Script but I can only get the "Processed Response".

I tried using:

var status = responseMap.get('ADT^A01 || A04 - CreatePatients').getMessage();

but I get the processed HL7 response instead. (The HL7 ACK).

Can someone please help me with an example?

It works fine for each Destination if I use the Edit Response, but as I don't know which Destination will be used I cannot use this.

Thank you everybody for your help.

pacitommaso 03-30-2018 02:56 PM

Ok I found a solution to my previous question.
I collect the returned information in some variable in the Destination - Edit_Response, and then in the PostProcessor I use these variables.

However now I have a second issue with the PostProcessor as the ACK / NACK messages are not send back to the caller.

I'm using the following Functions and Mirth 3.5:

For the Ack:
function sendAck()
// Generate an ACK response with code AA and put into the Response Map with SUCCESS status.
var ackMessage = ACKGenerator.generateAckResponse(message.getConnec torMessages().get(0).getRawData(), "AA", "Success");
responseMap.put("ACK Message", ResponseFactory.getSentResponse(ackMessage));
logger.info("ACK Msg Sent");

for the NACK (as I want to send a retrieved message):
function sendNack(ackMsgStr)
var ackMessage = ACKGenerator.generateAckResponse(message.getConnec torMessages().get(0).getRawData(), "AR", ackMsgStr);

responseMap.put("ACK Message", ResponseFactory.getErrorResponse(ackMessage));

I see that the functions are called (I see the logger.info) but nothing is sent. Can you give me a hint?

Thank you all for your help.

pacitommaso 03-31-2018 08:19 AM

I keep on responding to myself...:-) Anyway it was just a stupid mistake, and I was using the wrong setting in the Source to get the ACK.
Changed that and it worked fine.

All times are GMT -8. The time now is 10:24 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation