Oct 7th, 2010, 11:13 PM
Let me know the best approach please
I am very new to Spring framework, i have requirement to develop a webservice using JAX-WS and Spring for data access. Database has around 40 tables in it, if the request comes for a particular table i have to retrive the complete content in the table and send back as response. My Question is,
1) Do i need to have 40 Different methods for this or do we have any other option?
2) Which template in Spring would be the best approach?
Please help me with this.
Note: I am not asking for any code, guide me on the approach alone.
Nov 5th, 2010, 03:52 PM
It depends on where your data retrieving logic resides to fetch data from database.
If you use J2EE then I believe you already have EJBs and data is retrieved as POJO (entity bean). In that case it will be easy to expose EJB as web service and JAX-WS will automatically create the WSDL & artifacts for you when you use WsGen utility. But I am not sure if Spring has any exporter service to expose EJB-endpoint as webservice. Thus web service will be available as EJB-endpoint - not as a servlet endpoint. Since Spring works in webserver layer, it may not be possible to secure that Ejb-webservice using Spring Security Framework - at least I did not get any success yet.
Considering you do not have a J2EE environment, you can develop a java class in your webserver layer and expose that as a Spring web service. In this Java class you can maintain several data structures - each one to store data for each specific table. You can still use the same approach to generate WSDL & artifacts using JAX-WS.
Remember Spring supports "Contract First" approach for developing webservice - that means you have to start with a WSDL and then you can create Java class from it - which is cumbersome in this age.
I always prefer to develop Java Class first and then generate WSDL from there.
Hope you will get some idea about the development direction.
Last edited by kuntalm; Nov 5th, 2010 at 03:53 PM.
Reason: spell check
Tags for this Thread