Note that this regexreplace is meant to minify the XML if it’s not already minified (headers can’t be multiline values - you can also base64encode the content if you want to preserve whitespace), and that the body of the message isn’t fully loaded until after the first Foreach loop