jQuery in Action, 2nd edition*
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 39541
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.

Ping & DNS - updated with new look and Ping home screen widget
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36464
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: 2906
Please see here why the use of a HashMap should ultimately be avoided.

"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
wood burning stoves
subject: Java webservice
Similar Threads
accessing web service through a jsp/html
JNI in webserivices - Is it possible ?
Java webservice
Setting time out for web service call
getting ResultSet from Java Stored Procedure