apigw:set-payload
Assigns a value to the body of a message.
Namespace declaration
xmlns:apigw="http://www.ibm.com/xmlns/datapower/2017/11/apigateway"extension-element-prefixes="apigw"
Syntax
<apigw:set-payload
message="messageName"
value="value"/>
Attributes
message="messageName"- The
xs:stringthat specifies the name of the message. By default, the name ismessagethat indicates the current message during the API processing.The message name cannot be
request, which is a read-only context. value="value"- Specifies the value that is assigned to the body of the specified message.
Guidelines
The apigw:set-payload extension element assigns a value to the body of a
message. If the specified message name does not exist, a new message is created.
Examples
- Set the payload for a message by using a literal string for the message
name.
<xsl:template match="/"> <apigw:set-payload message="'message'" value="'hello world'"/> ... </xsl:template> - Set the payload for a message by using a variable for the message
name.
<xsl:template match="/"> <xsl:variable name="messageName" select="'message'"/> <apigw:set-payload message="$messageName" value="'hello world'"/> ... </xsl:template>