I have an existing database (PostgreSQL in my case), and would like to access its data (Create, Read, Update, Delete, Query) through SOAP Web Services.
What we are doing now, have JPA implementation of each Entity, and have an implementation of a generic CRUD interface. Then we expose these beans as JaxWS web services.
The problem with this setup is that JaxWS behaves weirdly with generic interfaces.
Since this is such a common problem, accessing DB through WS, i would like to know if there is an open source solution, which would expose all the entity tables as web services.
Such tool would require as input a set of JPA Classes (or some other data description), or even a JDBC connection (to pull the SQL Schema out) and would produce a set of CRUD web services.
Ideally, such a tool would mainly consist of a Servlet, that could be embedded in any web application.
Please, tell me your suggestions for such a tool, and if you had any experience with using it, please share.
Thank you in advice
Apologies for not answering the question, and instead saying “you don’t want to do that”, but …
First, you may not need to do that. Does your database already expose Web services directly? For example DB2 UDB and its tooling does the job for you. No need to write the Java at all.
Second, maybe you shouldn’t do it anyway? It’s pretty much an architectural anti-pattern to expose your entity layer directly as a Web service. The granularity tends make the service inefficient and hard to maintain in the long term. Web Services in the large tend to be better as quite coarse-grained business-meaningful services. For example creating an Insurance Policy might require several updates and inserts to several different tables. To expose the raw table access capability as web services means that evey client needs to know exactly what to do. Instead expose a Web service CreatePolicy() and let the implmentation own the gnarly stuff.