Table of Contents

Search

  1. Preface
  2. Understanding Data Types and Field Properties
  3. Designing Processes
  4. Using and Displaying Data
  5. Designing Guides
  6. Designing Process Objects
  7. Designing Service Connectors
  8. Using App Connections
  9. System Services, Listeners and Connectors
  10. Designing Human Tasks

Design

Design

HTTP and JMS Headers

HTTP and JMS Headers

Use header functions to get details about headers that you pass when you invoke a process. You can get details about process headers and message event headers.
Use header functions to get information that is only available in the header that you pass when you invoke a process. Examples include dates, JSON Web Tokens, and security IDs.
You can assign the header value to a field and, optionally, perform XQuery operations on the value.
The following image shows the header functions available under the
Request Context
section of the Expression Editor:
This image shows the Functions section of the Expression Editor with six HTTPS header functions under the Request context section.
To understand how each function works, consider a process invoked with the following headers and values:
Header
Value
accept-language
en-US;q=0.9
client-ip
192.0.2.1
accept
text/xml
postman-token
0023-a5dfd-8vdg3-n2b3
CustomHeader
This is a custom header
ExecutionDate
Wed, July 25 2018 06:25:24 GMT
You can use the following header functions on their own, or along with other functions:
Get All Header Values
Use the
getAllHeaders
function to get a list of all headers and their values.
For example, if you use the following expression, you get a specific output:
Expression:
fn:getAllHeaders()
Output:
<headers> <header name="accept-language">en-US;q=0.9</header> <header name="client-ip">192.0.2.1</header> <header name="accept">text/xml</header> <header name="postman-token">0023-a5dfd-8vdg3-n2b3</header> <header name="CustomHeader">This is a custom header</header> <header name="ExecutionDate">Wed, July 25 2018 06:25:24 GMT</header> </headers>
Get Date Headers
Use the
getDateHeader
function to get the value of a Date header. The function returns data in the dateTime type.
You can use other Date and Time functions to parse the value.
For example, if you use the following expression, you get a specific output:
Expression:
fn:year-from-dateTime(request:getDateHeader("ExecutionDate")
Output:
2018
Get a Specific Header Value
Use the
getHeader
function to get the value of a specific header.
For example, if you use the following expression, you get a specific output:
Expression:
request:getHeader("accept")
Output:
text/xml
Get a list of Headers Names
Use the
getHeaderNames
function to get a sequence of header names without values.
For example, if you use the following expression, you get a specific output:
Expression:
request:getHeaderNames()
Output:
accept-language,client-ip,accept,postman-token,CustomHeader,ExecutionDate
Get a Header value or 'Default'
Use the
getHeaderOrDefault
to get a header value if the header exists, or some default value if the header does not exist.
To use this function, you must give the header name and a default value as expression parameters.
Let the default value be
Not Available
.
For example, if you use the following expression, you get a valid output:
Expression:
concat ("The header I want is", request:getHeaderOrDefault("postman-token","Not Avaialble" )
Output:
The header I want is 0023-a5dfd-8vdg3-n2b3
If you use the following expression, you get a Not Available output:
Expression:
concat ("The header I want is", request:getHeaderOrDefault("special-token","Not Avaialble" )
Output:
The header I want is Not Available
This is because the request does not contain a header with the name
special-token
.
Check if a Specific Header Exists
Use the
headerExists
function to check if a header with a specific name exists.
You get either
True
or
False
in the output.
For example, if you use the following expression, you get a specific output:
Expression:
request:headerExists("CustomHeader")
Output:
True

Headers from Message Events

If a process has message events, you can use any header functions to get headers from the message events. To do this, you must add the case-sensitive message event name as an expression parameter.
For example, if you pass a header with the name
CustomHeader
to the message event receive step, use the following expression to get the value of
CustomHeader
from the message event
ME1
.
request:getHeader("CustomHeader","ME1")

0 COMMENTS

We’d like to hear from you!