web stats
Mirth Community - View Single Post - ACK Response
Thread: ACK Response
View Single Post
  #2  
Old 04-16-2014, 07:41 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

The destination response transformer transforms the response from your destination. A File Writer isn't a request/response connector in the way that a TCP Sender or HTTP Sender is, so there's no actual response payload to transform (hence the response transformer will not run, unless the data type is set to Raw).

Instead, set your source connector's Response setting to Postprocessor, and then build up your ACK manually in the postprocessor script:

Code:
var serializer = SerializerFactory.getSerializer('HL7V2');
var ack = new XML(serializer.toXML(new ACKGenerator().generateAckResponse(message.getConnectorMessages().get(0).getRawData(),'AA','')));
delete ack.MSH['MSH.7'];
ack.MSH['MSH.10']['MSH.10.1'] = 'RIS' + ack.MSA['MSA.2']['MSA.2.1'].toString();
ack.MSH['MSH.18']['MSH.18.1'] = '8859/1';
return serializer.fromXML(ack);
There are code templates on the right-hand side to help you with common things like converting between HL7 and XML, etc. Also for classes like ACKGenerator, you can right-click and select "View User API" to look at how they're used (or go here).
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote