Copying XML input into a Message header and passing through the XML input to the output

Hi

I need to pass some XML through an XMLMap connector, but I also want to preserve the original XML input, for later use.

My thought was to do this in a script before it hits the XMLMap

But I don’t know how to

  1. copy the Script connector input, straight out to the output
  2. copy the Script connector input into a message header

Thoughts

I think I’ve worked it out:

<arc:set attr="output.header:raworiginalorder" value="[_message.body]" /><arc:set attr="output.data" value="[_message.body]" /><arc:set attr="output.filename" value="[FileName]" /><arc:push item="output" />

I see what you mean now. You could also do this directly in the XML Map with a Script step inside the XML Map:

The code here is:

<arc:set attr="_message.header:originalXML" value="[_message.body | regexreplace('>\s+<','><')]" />

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