The Build Message policy provides a way to build the various parts of a 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 |
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 an 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. |
Show Expert
Click the Show Expert option to configure properties in the table below.
Figure 2: Assign Message Policy Expert properties Configuration attributes
Property | Description |
Variable Reference Prefix | Short prefix for the variable. For example, to build a JSON request, the symbol "<" (less than symbol) is preferred. |
Variable Reference Suffix | Short suffix for the variable. For example, to build a JSON response, the symbol ">" (greater than symbol) is preferred. |
Use this prefix instead of Policy Scope | By mentioning this prefix, one can choose the scope of Query parameters, Headers, Form parameters (mentioned in Set Message Details tab (see the Set Message Details section below) which should be modified.
|
Payload
Provide Payload content in the Payload editor.
Set Message Details
Figure 3: 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. |
Remove Message Details
Removes specified elements from the message variable specified. This is used to filter unwanted elements from an incoming message.
Figure 4: Remove Message Details
Examples
REST to SOAP Conversion
This 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 above.
Customizing API Request/Responses
In the example Customizing API Response, the JSON response that is expected by the client is built using this policy.