The last sentence should read "Also, be sure to include the
<Serializable>
attribute in your class definition."
>Gary,
>
>You cannot return an ArrayList from an XML Web Service because it implements the ICollection interface. In this situation, it is probably best to return an array of Employee objects. You can do this easily with the ToArray() method of the ArrayList class.
>
>The error that you are receiving is not the typical error that is thrown when trying to return an ArrayList, so you may have other problems as well. I am not familiar with a type specification that looks like "wsEmployee.EmpServices+Employee". Is the + sign part of the C# syntax for specifying a type? If it is not, you might have an issue with the Web Reference in the client project. Also, be sure to include the
attribute in your class definition.
>
>>I have defined a class called "Employee" in my web service that contains 3 instance variables: lastname, firstname and ssn. I have a web method that creates an arraylist of Employee objects. Stepping thru the debugger shows that the arraylist does indeed contain Employee objects as expected.
>>
>>However, returning this arraylist from the web method produces the following error:
>>
>>System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type wsEmployee.EmpServices+Employee was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
>>
>>Reading the docs on XMLIncludeAttribute and SOAPIncludeAttribute just left me scratching my head.
>>
>>Thanks in advance for any comments to help solve this.
>>
>>Gary