Manage Transport Properties/Headers Assertion

The Manage Transport Properties/Headers assertion allows you to add, replace, or remove custom HTTP header or JMS property in a message.
gateway83
The
Manage Transport Properties/Headers
assertion allows you to add, replace, or remove custom HTTP header or JMS property in a message.
This assertion always succeeds, as long as the target message exists.
To learn about selecting the target message for this assertion, see Select a Target Message.
(1) Use the Manage Transport Properties/Headers assertion carefully. The Gateway does not validate the headers in a message. Conflicting or malformed headers may produce unexpected results. (2) If you add more than one JMS property with the same name, only the last one added is used by the Route via JMS Assertion and by the incoming JMS request listener. (3) The Manage Transport Properties/Headers assertion cannot be used to add or remove headers in a WebSocket connection.
Contents:
Modifying Content-Type Headers
If you need to modify Content-Type headers, use the Validate or Change Content Type Assertion. Attempting to change these headers using the Manage Transport Properties/Headers assertion may result in duplicate Content-Type headers and incorrect interpretation of the message Content-Type. 
When removing Content-Type headers using the Manage Transport Properties/Headers assertion, this does not affect the actual Content-Type header coming out of the Gateway. Context variables (
http.allheadervalues, http.header/headervalues.Content-Type
) are affected as follows: 
  • For request messages, these context variables are removed.
  • For response messages, these variables remain.
Supported JMS Headers
JMS standard headers always exist in the message and cannot be added or removed. However, you can manipulate the values of these headers using this assertion.
As JMS standard headers cannot be added or removed,
the "Add" and "Add or Replace" options always behave as "Replace".
The "Remove" option only removes any modified value added through the "Add" or "Add or Replace" options.
Example:
You use this assertion to add '123456789' to JMSCorrelationID. This value is stored in the variable
${request.jms.header.JMSCorrelationID.modified}
.
If you then use the assertion to remove the 'JMSCorrelationID' header, the variable
${request.jms.header.JMSCorrelationID.modified}
becomes blank. However the variable
${request.jms.header.JMSCorrelationID}
retains its original value from the request.
To learn more about the context variables that are related to JMS, see Manage JMS Destinations.
JMS Header
Type
Description
JMSCorrelationID
String
Correlation ID for the message. This may be the JMSMessageID of the message for which this message generating this reply. It may also be an application-specific identifier.
JMSDeliveryMode
Integer
Distribution mode: 1 = Not Persistent or 2 = Persistent. A persistent message is never lost, even if a JMS server becomes unavailable.
JMSExpiration
Long
Message expiration date and time. This time is stored in a UTC standard format.
JMSPriority
Integer
The JMS API defines ten levels of priority: 0 (lowest) to 9 (highest). Priorities 0-4 should be considered gradations of normal priority, while priorities 5-9 are gradations of expedited priority.
JMSReplyTo
String
Name of the destination to which a reply to this message should be sent.
JMSType
String
Message type identifier that is supplied by the client when the message is sent.
JMS headers set on the request message that is specified in the Route via JMS Assertion apply to outbound JMS. Conversely, JMS headers set on the response message apply to inbound JMS.
Using the Assertion
  1. Do one of the following:
    • To add the assertion to the Policy Development window, see Adding an Assertion.
    • To change the configuration of an existing assertion, proceed to step 2 below.
  2. When adding the assertion, the Manage Transport Properties/Headers Properties automatically appear; when modifying the assertion, right-click
    <target>
    :
    [Add|Remove] [HTTP Header|JMS Property]...
    in the policy window and select
    Transport Properties/Headers Properties
    or double-click the assertion in the policy window. The assertion properties are displayed.
  3. Configure the dialog as follows:
    To...
    Do this...
    Add a new HTTP header or JMS property
    (possibly duplicating an existing item with the same name)
    1. Choose the type of metadata to add. Be aware that the add options behave differently for JMS Headers. See "Supported JMS Headers" above for details. 
    2. Choose the
      Add
      or
      Add or Replace
      operation:
      • "Add" may possibly duplicate an existing item with the same name.
      • "Add or Replace" replaces any existing header or property with the same name.
    3. Enter the name of the header or property to add. You may reference context variables.
    4. Optionally enter the value of the header or property. You may reference context variables.
      Tip:
      To use special characters, enclose them within double quotes.
    A new header or property with the specified information is added to the target message.
    Remove one or more HTTP header or JMS property
    1. Choose the type of metadata to remove. Be aware that the remove option behaves differently for JMS Headers. See "Supported JMS Headers" above for details. 
    2. Choose the
      Remove
      operation.
    3. Specify the
      Header/Property Name
      to remove using any of the following methods (case insensitive unless a Regular Expression is specified):
      • Enter the exact name of the header or property to remove.
      • Specify a context variable that resolves to the name of the headers or properties to remove.
      • Specify a regular expression that matches the headers or properties to remove, and then select the
        Regular Expression
        check box.
        (1) To remove all headers names with a matching value, use a regular expression that matches all header names (for example, ".*"). (2) You cannot use context variables when the Regular Expression check box is selected. If you require this functionality, use the Run Assertions for Each Item Assertion.
    4. Optionally, specify a corresponding
      Header Value
      using any of the following methods (case insensitive unless a Regular Expression is specified):
      • Enter the exact value to match.
      • Specify a context variable that resolves to the value to match.
      • Specify a regular expression that matches one or more values that you want to remove, and then select the
        Regular Expression
        check box.
        Note: 
        The Policy Manager does not validate the regular expression pattern.
      If you do not specify a value, then all matching HTTP header names or JMS properties are removed, regardless of value. If you specify a context variable that resolves to empty, then only the matching items that have an empty value are removed.
    The Manage Transport Properties/Headers assertion does not fail if no header matches the given name or value. However, the assertion fails if the context variable for the header/property name does not exist or if it resolves to empty.
  4. Click [
    OK
    ] when done.