[ Documentation Index ]

WSO2 Enterprise Service Bus (ESB) XPath Extensions Catalog

Contents

Introduction

WSO2 ESB supports standard XPath functions and variables through its underlying XPath engine. All these standard XPath features are available for configuring the ESB. XPath allows to build custom functions to extend its functionality. There are several custom XPath functions and variables defined by the WSO2 ESB for accessing various message properties.

Functions

There are two custom functions supported by the ESB.

  1. get-property
  2. base64Encode

get-property function

Syntax:

  1. get-property(String propertyName)
  2. get-property(String scope, String propertyName)

Get property function retrieves a message property at the given scope. If only the property name is specified without the scope it assumes the default syanpse scope.

Supported Scopes

  1. synpase
  2. axis2
  3. transport

Special Properties suported by get-property function

Name Return Value
To Incoming URL as a String or empty string («») if a To address is not defined.
From From address as a String or empty string («») if a From address is not defined
Action SOAP Addressing Action header value as a String or empty string («») if a Action is not defined
FaultTo SOAP FautTo header value as a String or empty string («») if a FaultTo address is not defined
ReplyTo ReplyTo header value as a String or empty string («») if a ReplyTo address is not defined
MessageID A unique identifier (UUID) for the message as a String or empty string («») if MessageID is not defined. This id is guaranteed to be unique.
FAULT TRUE if the message has a fault or empty string if message doesn't have a fault
MESSAGE_FORMAT Returns pox, get, soap11, soap12 depending on the message. If a message type is unknown this returns soap12
OperationName Operation name corresponding to the message. A proxy service with a WSDL can have different operations. If the WSDL is not defined ESB defines fixed operations

base64Encode function

Syntax:

base64Encode(string)

Returns the base64 encoded value of the argument.

Variables

There are several variables supported by the ESB. These are used for accessing various properties and refer to fixed parts in the ESB.

  1. $axis2
  2. $trp
  3. $ctx
  4. $url

These XPath variables gets the properties at various scopes.

$axis2

Gets the property at the axis2 scope.

i.e. To get the property named 'messageType' use the following XPath expression

$axis2:messageType

$trp

Gets a transport header.

i.e. To get the transport header named Content-Type use the following XPath expression

$trp:Content-Type

HTTP transport headers are considered to be case insensitive. So in HTTP case

$trp:Content-Type and $trp:CONENT-TYPE are equal.

$ctx

Gets a property at the default scope.

i.e To get the property named 'foo' at the default scope use the following XPath expresion

$ctx:foo

$url

Gets a URL parameter.

i.e. To get the URL parameter named 'bar' use the following XPth expression

$url:foo