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

  • SEARCH
  • Home
  • 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 6119307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:32:15+00:00 2026-05-23T15:32:15+00:00

I am having a problem returning an ArrayList from my web service (Java). I

  • 0

I am having a problem returning an ArrayList from my web service (Java).

I have written a test web service and client which consumes it. All appears to work fine – that is the client is calling the server and the server receives the operation request.

However, I have written a simple method that I want it to return an ArrayList.

I have my interface definition as follows:

@WebService
@SOAPBinding(style = Style.RPC)
public interface ISQLServerConnectionWS {

    @WebMethod
    ArrayList getSimpleArrayList();
}

I have my server side implementation to return the ArrayList:

@WebService(endpointInterface="WebServices.ISQLServerConnectionWS")
public class SQLConnectionWSServer
    implements ISQLServerConnectionWS {

    @Override
    public ArrayList getSimpleArrayList() {
        ArrayList al = new ArrayList();
        al.add( "This" );
        al.add( "is" );
        al.add( "a" );
        al.add( "test" );
        return al;
    }
}

And finally my client call to it:

ArrayList results = server.getSimpleArrayList();

The server populates the array list fine. However, back at the client side, the ArrayList is empty. It has a size of 0.

If I examine the WSDL at my URL (http://127.0.0.1:9876/myservice-sql?wsdl) for the executeSelectSQL, it looks like:

<message name="executeSelectSQLResponse">
    <part name="return" type="tns:arrayList"/>
</message>

Am I missing something obvious?

Edit:

However, if I have a web method defines in the interface as:

@WebMethod
String getAString();

and the server implementation:

@Override
public String getAString() {
    return "hello there";
}

then this works fine – "hello there" is received on the client.

  • 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-23T15:32:16+00:00Added an answer on May 23, 2026 at 3:32 pm

    Use an array instead of an ArrayList as JAXB cannot handle collections as top-level objects, only as properties of beans. Alternatively, create a bean and put the ArrayList in it.

    See bug: JAXB-223: JAXB doesn’t support collection classes as top level objects

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

Sidebar

Related Questions

I'm having some problem's grabbing a response stream from a request that returning status
I have am having a problem with EasyMock returning null for an expected (defined)
I am having a problem where a routine (that I cannot modify) is returning
We are having problem with the server migration. We have one application that are
I'm having problem when running my Windows Forms program. In the program, I have
I'm having a problem with MessageDigest returning different hash values on different computers. One
I am having a strange problem while returning a string. it says can not
The table I'm having problem with is pushed from another table controller, and there
I'm having a problem reading a text file in java and assigning it to
I have a problem with returning a list by executing a Select LINQ query.

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.