File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Java webservice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Java webservice" Watch "Java webservice" New topic

Java webservice

Akhil kumarS

Joined: Oct 16, 2007
Posts: 13
Is it possible to return a result set from a java webservice? If possible show me some codes. If it is not possible how can i get the result set values from webservice??
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
By "result set", do you mean an instance of java.sql.ResultSet? If so, the answer is no. Web services should be implemented in a platform-neutral way, and not return objects that tie you into one particular language. Use arrays instead.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46367
A question which would sit better on a different forum. Moving.
Nitin Pathak
Ranch Hand

Joined: Sep 25, 2006
Posts: 70
If the iterating over java.sql.ResultSet processed different data types, Intergers and String, use a HashMap (typecast in to Integer wrapper):

The server side can be coded in the following way:

The client side implementation can be described as:

Hope this helps!
[ December 16, 2008: Message edited by: Nitin Pathak ]
Peer Reynders

Joined: Aug 19, 2005
Posts: 2933
Please see here why the use of a HashMap should ultimately be avoided.
I agree. Here's the link:
subject: Java webservice
jQuery in Action, 3rd edition