web stats
Get Destination Response with Postprocessor - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-30-2018, 01:14 PM
pacitommaso pacitommaso is offline
Mirth Newb
 
Join Date: Jun 2015
Posts: 6
pacitommaso is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 03-30-2018, 02:56 PM
pacitommaso pacitommaso is offline
Mirth Newb
 
Join Date: Jun 2015
Posts: 6
pacitommaso is on a distinguished road
Default

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.
Reply With Quote
  #3  
Old 03-31-2018, 08:19 AM
pacitommaso pacitommaso is offline
Mirth Newb
 
Join Date: Jun 2015
Posts: 6
pacitommaso is on a distinguished road
Default

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.
Regards
Reply With Quote
Reply

Tags
httpsender, postprocessor, response

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:01 PM.


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