Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1092071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:37:40+00:00 2026-05-16T23:37:40+00:00

i am writing an application in which i am creating web services. i am

  • 0

i am writing an application in which i am creating web services. i am creating an operation(method) which retrieves database table values from database table in resultset. Hence we can’t return resultset value directly in web services. i am creating a class which holds the values from resultset. instead of resultset i am returning object[] of newly created class as follows :

 public HistoryInfoByUser[] get_HistoryInfoByUser(@WebParam(name = "email_Id")
  String email_Id) throws Exception{

        HistoryInfoByUser[] historyIn = null;
        if (conn != null) {
        CallableStatement cst = conn.prepareCall("{call sp_xxxx(?)}",ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
            cst.setString(1, email_Id);
            ResultSet resultSet = cst.executeQuery();
             int rowCount = resultSet.getRow();

           historyIn = new HistoryInfoByUser[rowCount];

          while (resultSet.next())
             {

                historyIn[rowCounter].setId(rowCounter);                               
           historyIn[rowCounter].setStartTime((java.util.Date)resultSet.getObject(1));
                historyIn[rowCounter].setType((String) resultSet.getObject(2));


             rowCounter++;
            }
        }
        return historyIn;
    }

but while trying to access those values in web service client, it is giving java.lang.NullPointerException.

here is the code that i am using in web service client for accessing resultset
values :

    public void get_HistoryInfoByUser(String email_Id) 
{      
               service = new DBService();

               port = service.getDBPort();

    try {

        List<HistoryInfoByUser> historyIn = port.getHistoryInfoByUser(email_Id);
      Iterator iterator = historyIn.iterator();
            while (iterator.hasNext()){
              System.out.print(iterator.next()+" ");  
            }
      } catch (Exception_Exception ex) {
        Logger.getLogger(DataBaseWSHelper.class.getName()).log(Level.SEVERE, null, ex);
    }

 }

I tried returning a singe row value by returning an object (HistoryInfoByUser) of newly created class instead of object[] (HistoryInfoByUser[] ). It works fine with single object but giving NullPointerException when i am using object[]. i am not getting any way which will help me to overcome with this problem of accessing resultset value.

I thank in advance to your all valuable suggestions which will help me to overcome with this problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:37:41+00:00Added an answer on May 16, 2026 at 11:37 pm

    Return a WebRowSet from your web service:

    import javax.sql.rowset.WebRowSet;
    import com.sun.rowset.WebRowSetImpl; // Reference implementation
    ...
    // get ResultSet rs from db
    WebRowSet wrs = new WebRowSetImpl();
    wrs.populate(rs);
    // return wrs from web service
    

    Note that your JDBC provider might provide a vendor-specific WebRowSet implementation. You can use that instead of the reference implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an application which needs to host several WCF services. One of the
I'm novice in android. I'm writing an android application which requires the data like
I'm writing an application that validates login credentials on an external webserver - so
Hello I'm creating application for android no mater what kind but I need to
I'm writing a computer vision app (C++ and OpenCV). I am creating a GUI
I'm creating an SL4 app that needs to query certain data via a webservice
I want to build an application to edit some fields in complex xml documents.
I am from Java Swing background. May I know why using XML to create
I have used IsHighlighter property of InkCanvas to create highlighter tool . In real
I am fighting with CoreData again and i need your help :P I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.