The Build Message policy provides a way to build the various parts of the message using the Context Variables available in the flow.
Various parts of the request such as Payload, Target URL, Headers, Query parameters and Form parameters can be modified using this policy. The populated message can then be sent to the Target Server or to a Service Call Out policy for invocation. Similarly, the response to be sent back to the client can be customized using this policy.
Configuration
The properties that have to be configured to use the policy are described below.
Figure 1: Assign Message Policy Configuration attributes
Property | Description |
---|---|
Create New | Choose the boolean value—true or false (false is the default value). Change the value to 'true' to create a new message instead of modifying the designated message. |
Ignore Unresolved Variables | If any of the variables being used as part of the configuration are not present in the incoming message, this property is used to determine whether the condition needs to be ignored or treated as error. when set to true, the flow continues as usual. Otherwise, an error is sent back to the client reporting that the property is missing. |
Variable Reference Prefix | Short prefix for the variable. For example, to build JSON request, the symbol "<" (less than symbol) is preferred. |
Variable Reference Suffix | Short suffix for the variable. For example, to build JSON response, the symbol ">" (greater than symbol) is preferred. |
Payload
Provide Payload content in the Payload editor.
Set Message Details
Property | Description |
---|---|
Content Type | The content-type of the message to be sent to the server can be set using this Header. |
Version | HTTP version of the outgoing request to the target Server. |
Verb | The HTTP method to be invoked on the target server. |
Status Code | The HTTP response Code to be returned to the Proxy client. |
Reason Phrase | The Reason phrase corresponding to the HTTP Response. |
Remove Message Details
Removes specified elements from the message variable specified. This is used to filter unwanted elements from an incoming message.
Examples
REST to SOAP Conversion
The policy is used in the automatic conversion of SOAP web services to RESTful services by the tool. It converts the incoming REST request into SOAP request by making the following changes.
- The SOAP envelope is added around the query parameters passed using the Payload Section.
- SOAPAction attribute is added using the Add Message Details section.
- All query parameters and the Content-Length header of Proxy request are removed using the Remove Message Details Section.
Customizing API Request/Responses
In the example Customizing API Response, the JSON response that is expected by the client is built using the Policy.