Bean Mediator
The Bean Mediator is used to manipulate a JavaBean that is bound to the Synapse message context as a property. Classes of objects manipulated by this mediator need to follow the JavaBeans specification.
The Bean mediator is a content-aware mediator.
Syntax
<bean action="CREATE | REMOVE | SET_PROPERTY | GET_PROPERTY" var="string" [class="string"] [property="string"] [value="string | {xpath}"] />
Â
UI Configuration
The parameters available to configure the Bean mediator are as follows.
Field Name | Description |
---|---|
Class | The class on which the action selected for the Action parameter is performed by the Beanstalks manager. |
Action | The action to be carried out by the Bean mediator. The possible values are:
|
Var | The variable which is created, removed, set or retrieved for the JavaBean based on the value selected for the Action parameter. |
Property | The name of the property used to bind the JavaBean to the Synapse client. |
Value | The value of the property used to bind the JavaBean to the Synapse client. The property value can be entered using one of the following methods.
You can click NameSpaces to add namespaces if you are providing an expression. Then the Namespace Editor panel would appear where you can provide any number of namespace prefixes and URLs used in the XPath expression. |
Target | The element of the message which should be affected by execution of the Bean mediator configuration. The target element can be specified using one of the following methods.
|
Note
You can configure the mediator using XML. Click switch to source view in the Mediator window.
Example
In this example, the Bean mediator first creates a JavaBean with the loc
as the variable. The next Bean mediator creates property named latitude
within the loc
variable using the SET_PROPERTY
action. The third Bean mediator creates another property named longitude
in the same variable using the SET_PROPERTY
 action.
... <bean action="CREATE" class="org.ejb.wso2.test.bean.Location" var="loc"></bean> <bean action="SET_PROPERTY" property="latitude" value="{//latitude}" var="loc" xmlns:ns3="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd"></bean> <bean action="SET_PROPERTY" property="longitude" value="{//longitude}" var="loc" xmlns:ns3="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd"></bean> ...