Hi!
First of all, enumerate the operations you want your web service to support. Then write a
Java class with one method for each of the operations. Finally, annotate the class with @WebService and
you should be done!
What server do you want to use to run the web service in? Each type of server has, more or less, different ways of setting up access to a database.
If you want to set up database access from your application and not involve the server, then I can recommend:
- Plain
JDBC.
Slightly verbose, as far as the code you have to write is concerned.
- Spring JDBC templates.
Nice and easy for simple applications. You will still issue plain SQL queries.
- Some JPA persistence provider, such as EclipseLink or Hibernate.
If you need ORM.
If you use Spring Roo to create your entity classes, then you get persistence with ORM "almost free" with very little work. Personally, I feel it is definitely worth the effort to do one or two tutorials on Spring Roo just to avoid writing DAOs and entity classes.
Best wishes!