Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In addition to standard XPath functions, the ESB supports the following custom functions for working with XPath expressions:

...

base64Encode() function

The base64Encode function returns the base64-encoded value of the specified string.

Syntax:
base64Encode(string)

synapse:get-property()
Anchor
func
func

The The get-property() function  function allows any XPath expression used in a configuration to look up information from the current message context. Using the the Property mediator, you can retrieve properties from the message context and header.

...

If you provide only the property name without the scope, the default Synapse scope default synapse scope will be used.

Synapse scope

When the scope of a property mediator is Synapseis synapse, its value is available throughout both the in sequence and the out sequence. In addition to the user-defined properties, you can retrieve the following special properties from the default scopethe synapse scope.

NameReturn Value
ToIncoming URL as a String, or empty string («») if a To address is not defined.
FromFrom address as a String, or empty string («») if a From address is not defined.
ActionSOAP Addressing Action header value as a String, or empty string («») if an Action is not defined.
FaultToSOAP FaultTo header value as a String, or empty string («») if a FaultTo address is not defined.
ReplyToReplyTo header value as a String, or empty string («») if a ReplyTo address is not defined.
MessageIDA unique identifier (UUID) for the message as a String, or empty string («») if a MessageID is not defined. This ID is guaranteed to be unique.
FAULTTRUE if the message has a fault, or empty string if the message does not have a fault.
MESSAGE_FORMATReturns pox, get, soap11, or soap12 depending on the message. If a message type is unknown this returns soap12
OperationNameOperation 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.


To access a property with the Default synapse scope inside the the mediate() method  method of a mediator, you can include the following configuration in a custom mediator created using the the Class Mediator:

Code Block
languagejava
public boolean mediate(org.apache.synapse.MessageContext mc) {  
// Available in both in-sequence and out-sequenc  
String propValue = (String) mc.getProperty("PropName");  
System.out.println("SCOPE_SYNAPSE : " + propValue);  
return true;  
}

 

axis2 scope

When the scope of a property mediator is axis2, its value is available only throughout the sequence for which the property is defined (e.g., if you add the property to an in sequence, its value will be available only throughout the in sequence). You  You can retrieve message context properties within the the axis2 scope  scope using the following syntax.

Syntax:
get-property('axis2', String propertyName)

To access a property with the the axis2 scope inside the mediate() method of a mediator, you can include the following configuration in a custom mediator created using the Class Mediator:

...

axis2-client

This is similar to the Synapse synapse scope. The difference is that it can be accessed inside accessed inside the mediate() method of a mediator by including one of the following configurations in configurations in a custom mediator, created using the Class Mediator:

Code Block
languagejava
public boolean mediate(org.apache.synapse.MessageContext mc) {  
org.apache.axis2.context.MessageContext axis2MsgContext;  
axis2MsgContext = ((Axis2MessageContext) mc).getAxis2MessageContext();  
String propValue = (String) axis2MsgContext.getProperty("PropName");  
System.out.println("SCOPE_AXIS2_CLIENT - 1 : " + propValue); 

...

Code Block
languagejava
propValue = (String) axis2MsgContext.getOptions().getProperty("PropName");  
System.out.println("SCOPE_AXIS2_CLIENT - 2: " + propValue);  
return true;  
}  

...

transport scope

When the scope of a property mediator is Transporttransport, it will be added to the transport header of the outgoing message from the ESB. You  You can retrieve message context properties within the the transport scope using  scope using the following syntax.

Syntax:
get-property('transport', String propertyName)

...

registry scope

You can retrieve properties within the registry using registry using the following syntax.

Syntax:
get-property('registry', String registryPath@propertyName)
get-property('registry', String registryPath)

...

system scope

You can retrieve Java System properties using properties using the following syntax.

Syntax:
get-property('system', String propertyName)

Note: The The system scope  scope is available in WSO2 ESB 4.8.0 and later.

...

operation scope

You can retrieve a property in the operation context level from the the operation scope scope. The The operation scope  scope is used to preserve properties within iterated/cloned message flows.   

Syntax:
get-property('operation', String propertyName)


Next, see Synapse XPath Variables.