If you look at the proxy code generated by Visual Studio or the WSDL,
you'll see that the Web service simply returns an array of objects. You
are not mentioning about adding attributes to declare the types found in
the ArrayList, which you need to do via attaching XmlElement attributes
on the return value if the return type is actually ArrayList
[WebMethod]
[return: XmlElement( typeof(arrayItemType ) )]
public ArrayList GetArrayList()
{
// ...
}
You may want to check out Christian Weyer's Contract First tool [0] to
generate the proxy code. Maybe it helps in your scenario.
Christoph
[0]
http://www.thinktecture.com/Resource...irst/default.h
tml
-----Original Message-----
From: SteveR [mailto:St****@discussions.microsoft.com]
Posted At: Wednesday, November 10, 2004 8:00 AM
Posted To: microsoft.public.dotnet.framework.webservices
Conversation: retrieve arraylist returned from webservice
Subject: retrieve arraylist returned from webservice
I want to return an ArrayList from my web service. I can write this
part and
everything compiles but I can't get the web application that uses the
web service to compile. I call the service aynchronously so then in my
code I have this to retrieve the ArrayList object.
public void CalcCallback(IAsyncResult ar)
{
ArrayList arrResults = ws.MyFunction(ar);
}
If I try to compile this I get an error
Cannot implicitly convert type 'object[]' to
'System.Collections.ArrayList'
Any idea how I can fix this? I found a sample web service on MDSN that
returned an ArrayList but it doesn't include the client app to go with
it. --
Steve