Set Message

Contents

Overview

The Set Message filter replaces the body of the message. The replacement data can be plain text, HTML, XML, or any other text-based markup.

You can use properties representing the values of message attributes in the replacement text to insert message-specific data into the message body. For example, you can insert the authenticated user's ID into a <Username> element by using the ${authentication.subject.id} property as follows:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Header>
  <Username>${authentication.subject.id}</Username>
 </soap:Header>
 <soap:Body>
  <getQuote xmlns="oracle.com">
   <ticker>ORM.L</ticker>
  </getQuote>
 </soap:Body>
</soap:Envelope>   

Assuming the oracle user authenticated successfully to the Enterprise Gateway, the message body is set to the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Header>
  <Username>oracle</Username>
 </soap:Header>
 <soap:Body>
  <getQuote xmlns="oracle.com">
   <ticker>ORM.L</ticker>
  </getQuote>
 </soap:Body>
</soap:Envelope>   

You can also use the Set Message filter to customize SOAP faults that are returned to clients in the case of a failure or exception in the policy.

Configuration

Perform the following steps to configure the Set Message filter:

  1. Enter a name for this filter in the Name field.
  2. Specify the content type of the new message body in the Content-type field. For example, if the new message body is HTML markup, enter text/html in the Content-Type field.
  3. Enter the new message body in the Message Body text area. You can use properties, as shown in the example above, to ensure that current message attribute values are inserted into the message body at the appropriate places. You can also load the message contents from a file by browsing to the location of the file using the Browse button.