This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release.

All docs This doc
Skip to end of metadata
Go to start of metadata

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 NameDescription
ClassThe class on which the action selected for the Action parameter is performed by the Beanstalks manager.
ActionThe action to be carried out by the Bean mediator. The possible values are:
  • CREATE: This action creates a new JavaBean.
  • REMOVE: This action removes an existing JavaBean.
  • SET_PROPERTY: This action sets a property of an existing JavaBean.
  • GET_PROPERTY:This action retrieves a property of an existing JavaBean.
VarThe variable which is created, removed, set or retrieved for the JavaBean based on the value selected for the Action parameter.
PropertyThe 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.

  • Value: If this is selected, the property value can be entered as a static value.
  • Expression: If this is selected, the property value can be entered as a dynamic value. You can enter the XPath expression to evaluate the relevant property value.

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.

  • Value: If this is selected, the target element can be entered as a static value. The static value should be entered in the text field.
  • Expression: If this is selected, the target element can be evaluated via an XPath expression. The XPath expression should be entered in the text field.

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>
...
  • No labels