This documentation is for WSO2 Enterprise Service Bus version 4.7.0 . View documentation for the latest release.
Skip to end of metadata
Go to start of metadata

The EJB mediator calls an external Enterprise JavaBean(EJB) and stores the result in the message payload or in a message context property. Currently, this mediator supports EJB3 Stateless Session Beans and stateful session beans.


<ejb beanstalk="string" class="string" [sessionId="string"] [remove="true | false"] 
  [method="string"] [target="string | {xpath}"] [jndiName="string"] /> 
      <arg (value="string | {xpath}")/>* 


EJB Mediator GUI



You can click the "Namespaces" link to add namespaces if you are providing an expression. You will be provided another panel named "Namespace Editor" where you can provide any number of namespace prefixes and the URL used in the XPath expression.


You can configure the Mediator using XML. Click on "switch to source view" in the "Mediator" window.

EJB specific options


Field NameDescription
Beanstalk IDReference to the application server specific connection source information, which is defined at the
ClassThis required the remote interface definition provided in the EJB 3.0 (EJB service invocation remote/home interface).
Session IDWhen the invoke ejb context in the form state-full bean then the related ejb session status specif id will be stored in here. Expression/Value
RemoveOnce invoke state-full/stateless session user can force and ask the Enterprise entity manager to remove the ejb context related parameters.
TargetIf a particular EJB method returns then the return object can be saved against the the name provided in the target at the synapse property context Expression/Value

The Java Naming and Directory Interface (JNDI) is an application programming interface (API) for accessing different kinds of naming and directory services. JNDI is not specific

to a particular naming or directory service, it can be used to access many different kinds of systems including file systems; distributed objects systems like CORBA, Java RMI, and EJB; and directory services like LDAP, Novell NetWare, and NIS+.

Method ArgumentsCan be used to define the arguments which is required for the particular ejb method to be invoked Expression/Value



<ejb beanstalk="jack" class="org.ejb.wso2.test.StoreRegister" method="getStoreById" target="store" jndiName="ejb:/EJBDemo/StoreRegsiterBean!org.ejb.wso2.test.StoreRegister">
     <arg xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" value="{get-property('loc_id')}"/>

In this example, the EJB Mediator does the EJB service invocation by calling getStoreById pubished at the application server and exposed via  ejb:/EJBDemo/StoreRegsiterBean!org.ejb.wso2.test.StoreRegister,

then response will be assigned to the target specified (variable/expression).

  • No labels