Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8696741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:20:39+00:00 2026-06-13T01:20:39+00:00

I have a Mirth channel that set up as a web service listener, it

  • 0

I have a Mirth channel that set up as a web service listener, it receives an ID, build an HL7 query message and send this query and eventually get back an HL7 response.

  • Channel Name: QueryChanel
  • Source Connector Type: Web Service Listener
  • Destination Connector Name: QueryToVista
  • Destination connector Type:LLP Sender.

This is the typical HL7 response I receive back from my query is as follow:

MSH|~|\&|VAFC RECV|FACILITY|VAFC TRIGGER||20121011141136-0800||ADR~A19|58269|D|2.4|||NE|NE|USA
MSA|AA|1234|
QRD|20121011051137|R|I|500000001|||1^ICN|***500000001***|ICN|NI|
EVN|A1|20121004064809-0800||A1|0^^^^^^^^USVHA\\0363^L^^^NI^TEST FACILITY ID\050\L|20121004064809-0800|050
PID|1|500000001V075322|500000001V075322^^^USVHA\\0363^NI^VA FACILITY ID\050\L~123123123^^^USSSA\\0363^SS^TEST FACILITY ID\050\L~9^^^USVHA\\0363^PI^VA FACILITY ID\050\L||JOHN^DOE^^^^^L|""|19800502|M||""|""^""^""^""^""^^P^""^""~^^""^""^^^N|""|""|""||S|""||123123123|||""|""||||||""||
PD1|||SOFTWARE SERVICE^D^050
ZPD|1||||||||||||||||""

I can get all the above to return if I set my Source’s Response From parameter to QueryToVista

However, I want to return only the value 500000001 from the above message. I’ve tried to play around with the transformer in the QueryChanel destination without success.

Update:

I tried to add a javascriptwriter connector after the QueryToVista connector in the same channel as follow:

   var destination = responseMap.get('QueryToVista');
   var responseMessage = destination.getMessage();

   //Fails with following error: TypeError: Cannot read property "QRD.4" from undefined
   var customack = ResponseFactory.getSuccessResponse(responseMessage['QRD']['QRD.4']  ['QRD.4.1'].toString())**


   //work but send the whole HL7 message
   var customack = ResponseFactory.getSuccessResponse(responseMessage.toString())**


   responseMap.put('Barcode', customack);

I can’t seem to use the normal transformation to retrieve the element at all.
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:20:40+00:00Added an answer on June 13, 2026 at 1:20 am

    You’re on the right track, but your update illustrates a couple of issues. However, your basic approach of using two destinations is valid, so long as “Synchronize channel” is checked on the Summary tab.

    Issue 1

    In your example, the HL7 response you are wanting to parse is in pipe delimited HL7 form. In order to access the elements using E4X notation (eg. responseMessage[‘QRD’][‘QRD.4’][‘QRD.4.1’]) you must first convert it into an E4X XML object. This can be done in two steps.

    • Convert the pipe delimited HL7 string into an XML string.
    • Convert the XML string into an E4X XML object

    In a Javascript transformer of the JavaScript Writer (not the Javascript Writer script itself)

    var response = responseMap.get("QueryToVista");
    var responseStatus = response.getStatus();
    
    // Get's the pipe delimited HL7 string
    var responseMessageString = response.getMessage();
    
    if (responseStatus == "SUCCESS")
    {
        // converts the pipe delimited HL7 string into an XML string
        // note: the SerializeFactory object is available for use in transformer
        //       scripts, but not in the Javascript destination script itself
        var responseMessageXMLString = SerializerFactory.getHL7Serializer(false,false,true).toXML(responseMessageString);
    
        // convert the XML string into an E4X XML object
        var responseMessageXMLE4X = new XML(responseMessageXMLString);
    
        // grab the value you want
        var ack_msg = responseMessageXMLE4X['QRD']['QRD.4']['QRD.4.1'].toString();
    
        channelMap.put('ack_msg', ack_msg)
    }
    else
    {
        // responseStatus probably == "FAILURE" but I'm not sure of the full range of possibilities
        // take whatever failure action you feel is appropriate
    }
    

    Edit**

    I don’t believe there is an Issue 2. After reviewing your own approach, I played a bit further, and believe I have confirmed that your approach was indeed correct for generating the SOAP reponse. I’m editing this section to reflect simpler code that still works.

    In the Javascript Writer script

    var barcode = channelMap.get('ack_msg');
    var mirthResponse = ResponseFactory.getSuccessResponse(barcode);
    responseMap.put('Barcode', mirthResponse);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a web service that implements REST (sort of) , Client request is made
The scenario is around calling an external SSL SOAP web service from within Mirth.
I am trying to learn a mirth system with a channel that is pulling
Consider a scenario where a Mirth channel has one or more Destinations. In this
Mirth is a broker to help with healthcare application HL7 message integration. My question
I'm using the Mirth Connect listener and so can receive HL7 XML fine (apparently).
Have data that has this kind of structure. Will be in ascending order by
Have a query that should hopefully be nice and simple to answer. I have
I have a destination which sends an HL7 v2 message to a WCF webservice.
have written this little class, which generates a UUID every time an object of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.