The Set Body EIP defines or modifies the message body.
Parameter | Description | Default value | Type |
|---|---|---|---|
| Expression | Defines the value that will be set in the message body (body). | ExpressionDefinition |
The expression allows you to calculate or dynamically define values during message processing in the integration flow. It is a way to configure behaviors that can vary according to the context of the message in transit.
The expression is organized into two hierarchical levels that allow the structure to be more extensible and adaptable to different contexts:
First level: specifies the type of logic that will be applied (constant, jsonPath, xPath, etc.).
Second level: defines the actual value of the expression, that is, the data that will be assigned to the message body.
constant: defines a fixed value, useful for static messages.
In the example, it always sets the message body as the static JSON {"status": "error"}.jsonpath: extracts data from the message body when it is in JSON format.
In the example, it extracts the value located at $.data.attributes from the JSON in the message body.xpath: extracts information when the message body is in XML format.
In the example, it selects the XML node corresponding to /response/body/item from the message body.script: allows you to use scripting languages (JavaScript, Groovy, etc.) to dynamically create a body.
In the example, it executes a JavaScript script to dynamically generate the message body.binary: defines a binary body, useful for sending files or non-textual data.
In the example, it sets the message body as Base64-encoded data.<id> element.expression parameter uses the simple language, which allows you to insert dynamic values and perform simple string manipulations.${header.id} inserts the value of the header called "id" into the XML.We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more