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.
There are two custom functions supported by the ESB.
Syntax:
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.
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 |
Syntax:
base64Encode(string)
Returns the base64 encoded value of the argument.
There are several variables supported by the ESB. These are used for accessing various properties and refer to fixed parts in the ESB.
These XPath variables gets the properties at various scopes.
Gets the property at the axis2 scope.
i.e. To get the property named 'messageType' use the following XPath expression
$axis2:messageType
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.
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
Gets a URL parameter.
i.e. To get the URL parameter named 'bar' use the following XPth expression
$url:foo