Skip to Content
author's profile photo Former Member
Former Member

Web Service Model with ArrayList return value


I wrote a session bean method that returns an java.util.ArrayList.

Then I generated a web service for this session bean and imported this web service into a Web Dynpro model.

I can then execute this web service model and get the ArrayList in the method result (means in the result of the model instance) but I cannot bind this model to e.g. a table control with the following error message:

"ContextAttribute has JavaNativeType ArrayList. ContextAttribute with java native type cannot be selected."

This is o.k. so far but is there a way (workaround) to use any collection class as result of my web service method?

Background: Normally I´m and many users work with the java collection framework. At the moment I have to convert the Collection into an array with the following construct and return the array.

MyType[] tmp = new MyType[1];

return (MyType[])list.toArray(tmp);

When I then create a model in Web Dynpro the members of MyType are generated as model attributes.

This works but is not the way I would like to work. I would prefer to work with my Collection class.

Thanks for an answer


Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on May 09, 2004 at 03:46 AM

    Hi Helmut,

    i guess, collections cannot be used for model binding, since they may contain different kinds of objects. As you know for sure, this is not the case for model- and value nodes, their entries are restricted to one element "type". So from my point of view the only workaround is to convert collections into arrays, like you're already doing it.

    Best regards


    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Stefan,

      thank you for your answer. My question was more thought as a suggestion.

      When using the Value Objects Pattern in J2EE applications I use the same value object class at server (EJB) and client side (web app.) by utilizing the same class file.

      If I could do the same with Web Dynpro models (declarativly tell the model wich class to use) this would be great, wouldn´t it?

      Regards Helmut

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.