Announcement

Collapse
No announcement yet.

Get Destination Response with Postprocessor

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    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.

    Comment


    • #3
      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

      Comment


      • #4
        I am working on similar issue but with multiple destinations on a TCP sender. Was the issue that you received the response back to the destination connector but it was not passed from there to the source and then to sending application?

        Comment

        Working...
        X