web stats
Modify response from Web Service Sender - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 09-05-2019, 12:14 PM
mhaase mhaase is offline
OBX.2 Kenobi
Join Date: Dec 2015
Posts: 60
mhaase is on a distinguished road
Default Modify response from Web Service Sender

I am needing assistance in modifying a response from a Web Service Sender.

In the response transformer, it's defined as follows:

var res = msg.*::['Body'].*::['Request_x0020_or_x0020_Post.....].toString()

Which is then mapped: responseMap.put("ImmuResponse", res);

The response is then sent as follows:


What I am needing help on is modifying some of the segments in the message prior to reaching its destination. I've looked on the forums but wasn't able to find anything that pertained to this and this is the first time I've had to work with responses.

Any assistance on this would be greatly appreciated!

Thank you,

Using Mirth 3.6.1
Reply With Quote
Old 09-05-2019, 01:10 PM
agermano agermano is offline
Mirth Guru
Join Date: Apr 2017
Location: Indiana, USA
Posts: 964
agermano is on a distinguished road

If I understand correctly that res contains an hl7 string, you can manually call the Serializer to convert to and from xml in a similar fashion to what happens when your transformer datatype is set to hl7v2.

Serializer example code can be retrieved from the reference section in the transformer with names such as "Convert HL7 v2.x to XML."

Remember the serializers always return strings, so it's necessary when converting to xml to wrap the return value with a new XML() call in order to convert it to an e4x xml object.

var resRaw = msg.*::['Body'].*::['Request_x0020_or_x0020_Post.....'].toString();

var serializer = SerializerFactory.getSerializer('HL7V2');

var res = new XML(serializer.toXML(resRaw));

res['PID']['PID.1']['PID.1.1'] = 1234;

var resTransformed = serializer.fromXML(res.toXMLString());

responseMap.put("ImmuResponse", resTransformed);

Last edited by agermano; 09-06-2019 at 09:21 AM.
Reply With Quote
Old 09-06-2019, 07:40 AM
mhaase mhaase is offline
OBX.2 Kenobi
Join Date: Dec 2015
Posts: 60
mhaase is on a distinguished road

This worked for what I needed - thank you so much!

Reply With Quote

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 12:43 PM.

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