Skip to main content
Version: 4.11.2

SetHeader component

In Dovetail each processed message consists of a body and headers. The body of a message is the actual contents of the message, e.g. the data that's being processed. The headers contain meta data and are usually used only internally by Dovetail components.

The SetHeader component can be used to alter the headers of a message. You can chain multiple setHeader components together to modify multiple headers. You can also set custom headers for your own personal use.


This component can not be used as the first component in a flow, as it expects to alter the headers of a message. To use the Set Header component you must provide a valid message header name and a valid expression.

The Setheader component has the following configuration options:

Header NameThe name of the header you wish to set
Expression TypeThe language of the expression. Expressions can be defined using the Simple Expression Language, which also supports File Expression Language, or XPath 2.0
ExpressionHow you wish to change header


  • Header Names can not contain spaces
  • XPath only returns plain text, no xml
  • Headers in Dovetail are case-insensitive so setting a header named subject on an exchange that already has a header with the name Subject will just replace the value of the existing header named Subject.

Some expression examples

1 - Change filename with date

Header Name: CamelFileName

Expression: input_${date:now:yyyyMMdd_HHmmssSS}.xml

Result: The filename will be input_20130618_17121212.xml

2 - Change file extension (using a File Expression Language)

Header Name: CamelFileName

Expression: ${file:onlyname.noext}.test

Result: The extension of the input file will be replace with test. If your input file is file1.xml, your output will be file1.test

3 - Put the value of a xml node on the header using xpath

Consider the following XML in the body:

<?xml version="1.0"?>
<Bar>Value 1</Bar>
<Bar>Value 2</Bar>
<Bar>Value 3</Bar>

Header Name: NameItSomething

Expression Type: XPath

Expression: /Root/Foo/Bar[1]/text()

Result: The value of the header NameItSomething will be Value 1.

4 - Custom URL

Header Name: CamelHttpUri


Result: This will override the http uri set in the following http component.

5 - Variable HTTP Query params

This example will show you how you can retrieve variable query params with input of previous actions. In this example we use the bitcoin price feed. Say you want to fetch an xml from that feed you will use the uri Notice the currency in this case is fixed but you want to be more flexible then you can configure the setHeader component as follows

Header Name: CamelHttpQuery

Expression: feed_type=xml&currency=${bodyAs(String)}

Result: When you have a http component specified after the setHeader component it will use the this http query and append it to the Http URI. The ${bodyAs(String)} in this case will contain the currency value(e.g. EUR or USD)(Note: the previous component was a inbound http component, the body of the request contains the currency)

How do you setup the other components? The http component you only use as URI you leave out the query params. Also notice you don't place a ? at the end.