Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I return a ArrayList over SOAP?

 
Fredrik Andersson
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I would like to be able to return a ArrayList over SOAP.
Not a Array (Object[]).
I use Axis2.

Correct me if I'm wrong when I say that to be able to do this I need to use some products like JiBX or XMLBeans?
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this older thread has a nice discussion on perhaps why you want to actually stick with Object[] as opposed to ArrayList. Hope that helps!
 
Fredrik Andersson
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

Thanks for your reply!

I have done som thinking and discuss this issue.

I have came to the conclusion that it is likely a better idea to return a Object[], then a ArrayList.

Assume that the client suddenly is a .NET or PHP, then it most likely will have trouble to create an instance of this java.util.ArrayList.

Correct me if I'm wrong!!

Best regards
Fredrik
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are indeed correct! Web services by their nature need to work with data constructs that are recognizable/convertible across 'all' languages.
[ October 07, 2008: Message edited by: Martijn Verburg ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want the client to get an ArrayList?

I doubt the client is going to do anything with the data besides iterate through the array, but if they need an extensible collection, it is quick to make one given an array in any language.

Bill
 
Fredrik Andersson
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

The idea I was working on was to port a rmi-technic for a app that for eg had a method like:

public ArrayList getMyList()....

...to a implementation with a webservice-technic instead.

But I guess you agree with me, as I mentioned above, that it is a bad idea.

Best regards
Fredrik
 
Fredrik Andersson
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry wrong post!

[ October 13, 2008: Message edited by: Fredrik Andersson ]
[ October 13, 2008: Message edited by: Fredrik Andersson ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!