Injector Service

Injector Service

With the XPath injector service you can either add a value to an existing XML element inside a MessagePart, or add this value as a new child element. You can also add an attribute to an existing node.

The value can be set using a Constant value or a Message Header. This service can be used to enrich XML data directly using XPath expressions.

In the table below, you will find an explanation of these properties. All attributes with a ‘*’ are mandatory.




By default, we fill this out with the technical ‘tag’, followed by a serial number. Changing the name is optional.


Set this value to true, if you want this service to be enabled.

Namespace Aware

When set to true, the XPath expression will be executed in namespace aware mode. The default is false.

XPath Expression* XPath expression that will be executed to collect the target element. This expression must return a node, not a text.
Tag Name Name of the XML element to be created under the node that is collected by the XPath expression. If left empty, the value will be injected in the collected node instead. When Add Attribute is set to true, this will result in the creation of a new attribute on the parent node.
Namespace URI

This attribute is only visible when the attribute Namespace Aware has value true.

Namespace URI of the XML element or attribute to be created under the Node that is collected by the XPath Expression.

Add Attribute When set to true, injector will add an attribute using Tag Name as its name. The default is false.
Source Choose either CONSTANT or HEADER as a source for the injection. If you choose HEADER, you can add the Header Name, if you use CONSTANT, you can add the Constant Value. These fields appear dynamically.
Constant or Header Value Name of the constant or the name of the header from which the value is collected.

Here, you can specify the name of the MessagePart, which will be used as input.

The default value is msgprt0. Only use this when you are in fact using different names and/or MessageParts.

MessagePart-Out Here, you can specify the name of the MessagePart, which will be used as output for the service method. The default value is msgprt0.


Description of the specific service. This is for documentation purposes.


Injecting namespaced elements and attributes

In XML, elements and attributes can have namespaces. For example,

<foo xmlns=""/>

<example:foo xmlns:example=""/>

<foo xmlns:example="" example:bar="baz"/>

The first example defines a new default namespace, the second defines a new namespace example and declares foo to be an element in this namespace, and finally the third example also defines a new namespace example and defines the attribute bar to be in this namespace.

You can inject namespaced elements and attributes by setting Namespace Aware to true and defining a Namespace URI. If you also define a prefix in the Tag Name, e.g. example:foo, you introduce a new namespace. Otherwise, you define a new default namespace.

Note that namespaced attributes must have a prefix in the tag name.