I'll answer my own question to share it in case someone is looking. This was based on this post: http://soa-thoughts.blogspot.co.nz/2007/07/cdata-mapping-experience-inside-biztalk.html
I ended up creating a Helper class:
public class MessageHelper
{
/// <summary>
/// Sets a CDATA section in a XLANG message.
/// </summary>
/// <param name="message">The xlang message.</param>
/// <param name="xPath">The xpath for the element which will contain the CDATA section.</param>
/// <param name="value">The contents of the CDATA section.</param>
/// <returns>The resulting xml document containing the CDATA section</returns>
public static XmlDocument SetCDATASection(XLANGMessage message, string xPath, string value)
{
if (message == null)
throw new ArgumentNullException("message");
if (message[0] == null)
throw new ArgumentNullException("message[0]");
var xmlDoc = (XmlDocument)message[0].RetrieveAs(typeof(XmlDocument));
var cdataSection = xmlDoc.CreateCDataSection(value);
var node = xmlDoc.SelectSingleNode(xPath);
if(node !=null)
{
node.InnerText = String.Empty;
node.AppendChild(cdataSection);
}
return xmlDoc;
}
}
This is how you call it from the shape after the DLL was GAC:
MessageOut = MessageHelper.SetCDATASection(MessageOut, "/Envelope/Body/MsgFFmt", _string);