Have you tried invoking:
StreamToBytes
BytesToString
Log the data
From within your gateway service to “sanity check” what’s being passed in before it gets delivered to TN?
This should help you determine whether the problem is created before TN is even involved.
Regards
#webMethods#Integration-Server-and-ESB#edi