I have 2 classes that are shared between my webservice and my client app (both in c#)...
ANDCode:public class ImageFile { private string m_sFileName; private csAWCDefines.UploadType m_uploadType; public ImageFile() { } public ImageFile(string sFileName, csAWCDefines.UploadType uploadType) { m_sFileName = sFileName; m_uploadType = uploadType; } public string FileName { get { return m_sFileName; } } public csAWCDefines.UploadType UploadType { get { return m_uploadType; } } }
I fill the ArrayContainer::m_aryFiles like this in a [WebMethod]...Code:public class ArrayContainer { public System.Collections.ArrayList m_aryFiles; public ArrayContainer() { m_aryFiles = new System.Collections.ArrayList(); } }
I am passing an instance of the ArrayContainer class by ref from my client to my webservice.Code:[WebMethod] public bool FillArry(ref ArrayContainer aryContainer) { string sImage1 = @"test1.img"; string sImage2 = @"test2.img"; aryContainer.m_aryFiles.Add(new ImageFile(sImage1, csAWCDefines.UploadType.uploadClean)); aryContainer.m_aryFiles.Add(new ImageFile(sImage2, csAWCDefines.UploadType.uploadClean)); return true; }
Instead of returning as planned, I get the following error...
I think XmlInclude might be the answer to my problem, but I'm not sure how to implement it in this case. Anyone have any suggestions? Do I implement XmlInclude as part of the ImageFile class? The ArrayContainer class? Neither? Where/how do I implement it correctly?Additional information: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type ImageFile was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.




Reply With Quote