Hi!!
So how to create a simple web service with a backend without wasting too much effort?
Simple. Here are the steps:
1) Install Netbeans (at this time…6.9.1) and MySql (with Workbench)
2) Configure MySql. Create a user account for this test.
3) Create your ER-diagram in MySql workbench. Define the tables as MyISAM not InnoDB. Synch it to your db motor.
4) Open Netbeans > New Project > Create a EJB Module
5) Configure your persistance.xml (the database settings)
6) Create your entities first by “Creating entity beans from database”.
7) Then create your Persistance layer (this helps to manage connections with the database) by “creating session beans from entities”.
8 ) Now create a package ‘business’
9) Create all your session beans here. Make them local for this purpose.
10) When referencing ‘facade’ beans, use the @EJB annotation (place the classes you need as variables)
11) Create the web service layer by creating a package ‘webservice’ and then generating the web service based on your ‘business’ package (it will map all your operations as services).
12) Start Glassfish and deploy your new app!! š
Cumps!!
PS – To test, you may create a client using the Netbeans generator or simply go to GlassFish’s admin page and use the Tester there š
Leave a comment