Embedded CDATA tags are not allowed in XML. This is not a Qvera limitation but a rule in the XML specification. However, we can use a preprocessing script to remove the extra CDATA tags. This should only be a temporary workaround and whoever is sending the data should correct the payload being sent.
Here is how to use the preprocess script:
1. Set the source to use the preprocess script on failed messages
2. Use the following script in the script window:
//Convert bytes to string;
var messageString = new java.lang.String(bytesIn);
qie.debug('messageString: ' + messageString);
//Get the content
var content = StringUtils.substringBetween(messageString, '<Content>', '</Content>');
qie.debug('content: ' + content);
//remove all CDATA entries
content = StringUtils.replace(content, '<![CDATA[', '');
content = StringUtils.replace(content, ']]>', '');
//Put one CDATA tag around the content
content = '<![CDATA[' + content + ']]>';
//build bytesOut with new content
var newMessageString = new java.lang.String(StringUtils.substringBefore(messageString, '<Content>') + '<Content>' + content + '</Content>' + StringUtils.substringAfter(messageString, '</Content>'));
bytesOut = newMessageString.getBytes();
if (bytesOut === null) { //When null, the message is discarded and no further processing is done
//todo: when bytesOut = null, set responseBytes to acknowledge the receipt of discarded messages as needed
responseBytes = new java.lang.String('Replace with valid acknowledgement').getBytes(qie.getChannelEncoding());
}