Your question tells us what your data looks like, but nothing about
what the return type of your function is. Can you post the signature of
the web service-visible method, as well as an outline of any
non-framework types that may be used in that signature?
As for the "best way" to do it, that's probably to create a shell
return type struct or class and dump that. The web service framework
will automatically serialize it as XML:
public struct myReturnType
{
public int ID;
public string FirstName;
public string LastName;
public DateTime Date;
}
If your method has the following signature:
[WebMethod]public myReturnType[] GetRecords(...) { ... }
you'll get back something vaguely like:
<GetRecords>
<myReturnType>
<ID>1</ID>
<FirstName>John</FirstName>
...
</myReturnType>
<myReturnType>
<ID>2</ID>
...
</myReturnType>
...
</GetRecords>
That's about the best way to use web services.
Stephan
John wrote:
Hi,
I am implementing web services and try to return a collection of records,
say
1,"John","Doe",1/1/1990
2,"Jane","Doe",2/1/1990
3,"Joe","Smith",3/1/1990
......
In my c# project I have a class that implements ICollection to provide these
data.
When I try to make web method to return the class, I got :
The return type of .... is not CLS-compliant.
What is the best way to return a collection of records from a web method?
TIA