EJB Services feature in WSO2 Application Server to expose an externally deployed J2EE compliant Enterprise Java Beans (EJB) application as a web service. So an existing EJB service can be exposed as a SOA web service and this service will also be eligible for the fill advantages of WSO2 carbon features such as security, throttling, caching, etc. In the sample EJB library system is implemented. Its build as a java enterprise archive (ear) ans needs to be deployed in an external J2EE compliant application server. Then the library system cam be exposed as a WS via WSO2 Application Server. The sample is based on EJB 3.x.
Sample contains the following items.
|-- build.xml ant build file |-- ejb/ module for creating the EJB jar archive and java sources bundle `-- ear/ module for creating the enterprise application archive
If you are using windows get a command line shell,
go to, CARBON_HOME\samples\EJBLibrary\ then run, \EJBLibrary\> ant
If in linux from console,
go to CARBON_HOME/samples/EJBLibrary/ and run, /EJBLibrary$ ant
Now all the resources for the sample are built. Required resources for the sample are following,
To deploy and run the sample follow the instruction below.
Deploy the ear archive (library.ear) in a J2EE compliant application server.
eg: jboss, glassfish, bea weblogic, apache gerenimo
This needs to be configured via the WSO2 Application Server's ejb-services UI.
eg: If the EJB is deployed in,
CARBON_HOME/repository/components/lib
CARBON_HOME/repository/components/lib
Also add EJBLibrary/ejb/target/library.jar into CARBON_HOME/lib
Remote Interface : org.wso2.appserver.samples.ejb.LibraryManager Bean JNDI Name : LibraryManager (Please use the correct JNDI name is its different from the given value)
Now the ejb-service would be created and deployed. For more information on using the ejb-services UI, please refer to ejb-services userguide.
If the created ejb-service is successfully deployed it will be shown under web services listing in the WSO2 Application Server.
go to Manage > Web Services > List and you will be able to see the deployed ejb-service (library). Click on the service and it will show the service dashboard. Now click try-it and the try-it page for the service open. This can be used to invoke the ejb-service and hence EJB service deployed in the external application server.