Copying message headers by using a JavaCompute node

You can copy message headers by using a JavaCompute node.

The Modifying Message Class template in the JavaCompute node wizard generates the following code to copy message headers using a JavaCompute node:
public void copyMessageHeaders(MbMessage inMessage, MbMessage outMessage) throws MbException
{
	MbElement outRoot = outMessage.getRootElement();
	MbElement header = inMessage.getRootElement().getFirstChild();

	while(header != null && header.getNextSibling() != null)
	{
		outRoot.addAsLastChild(header.copy());
		header = header.getNextSibling();
	}
}