// MSH header refers to dummy, but not the other way round!
DeepCopy.copy(header, (Segment)dummy.get("MSH"));
try {
HL7Exception hl7e = new HL7Exception(theDescription, theErrorCode);
AcknowledgmentCode code = theAckCode == null ?
AcknowledgmentCode.CR :
AcknowledgmentCode.valueOf(theAckCode);
Message out = dummy.generateACK(code, hl7e);
String originalEncoding = ourParser.getEncoding(theMessage.getMessage());
String ackText = ourParser.encode(out, originalEncoding);