WebService and the ArrayList

  • Thread starter Thread starter JPSutor
  • Start date Start date
J

JPSutor

I am trying to pass back an ArrayList from a WebService to a windows
application. The app barks at me saying this is an ilegal operation.
Any hints or sample code out there?
 
JPSutor,

You should pass back an array, the web service should be able to handle
this ok. When passing back an ArrayList, the web service doesn't know what
the content of the ArrayList is (it holds objects) so it can't send back an
accurate type description through WSDL.

Hope this helps.
 
Nick,
I don't know how many elements are going to be in the array when I
start, so how can I use an array?
 
JPSutor,

You can declare the return type as an array, and then in the method, you
would use an ArrayList. When returning from the method, you can call the
ToArray method on the ArrayList to return an array.
 
Back
Top