axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kay Chee Cheung" <Kay.Chee.Che...@opsm.com.au>
Subject Re: Return Data As ResultSet
Date Wed, 25 Feb 2004 04:17:11 GMT
    I had done similar thing with web service. I borrow the codes from
"chapter 2" examples from the book, Web Service in a Nutshell by Kim
Topley ( www.oreilly.com/catalog/javawsian ). In the book's example, a
web service is returning an array of book objects. In the code, the book
objects were converted first to a list and then the list is converted to
the array which is the object that is finally returned.

     In my code, I started with a result set of customers, convert them
to a list of customers, and finally converting them to an array. 

      The following is a portion of the codes that I used, part of it
from the example. Hope it would help. I am only a beginner so I do not
understand the rational behind the codes.

Regards
Kay Chee

         java.sql.ResultSet rs = statement.executeQuery(

                  "Select party_id, party_title, gender, l_name,
f_name,	address_1, address_2, suburb, post_code, state, m_phone,
branch_num, trans_date from work.out");



            /* Get the credit limit and return it to the calling client
*/



            while( rs.next() )

            {



			Calendar cal = new GregorianCalendar(1999, 11,
31);

	 		int x = 0;

			list.add(new CustInfo(

				rs.getInt("party_id"),

				rs.getString("party_title"),

				rs.getString("gender"),

				

  				rs.getString("l_name"),

  				rs.getString("f_name"),

				rs.getString("address_1"),

				rs.getString("address_2"),

				rs.getString("suburb"),



				rs.getString("post_code"),

				rs.getString("state"),



  				rs.getString("m_phone"),

				
				rs.getInt("branch_num"),

				
				cal



				));

            }

        }

        catch( Throwable t ) {

            ....;

         }





        finally {

            try{

                ....

            } catch(Throwable t) {

                ...;

            }

            custInfo = new CustInfo[list.size()];

            list.toArray(custInfo);

       }
	return custInfo;






     

>>> APriyanjitih@virtusa.com 02/25/04 02:05pm >>>


> I need to return a ResultSet  from a Java server running AXIS a AXIS 
client. I know that not every object can be serialized and so I would
like to ask if is it possible to return it as it is or if it is
necessary to transform it in something else before sending, or what
else. Has somebody done something similar? Your help would be very
appreciated. 
> best regards, 
> G J A Priyanjith

Mime
View raw message