以下に示すように、List オブジェクトを返す単一の WebMethod があります。
[WebMethod]
public List<ContactMaster> GetContacts()
{
//ContactMaster contact = new ContactMaster();
List<ContactMaster> contacts=new List<ContactMaster>();
IQueryable<ContactMaster> contact = from c in db.ContactMasters
select c;
foreach (ContactMaster c in contact)
{
contacts.Add(c);
}
return contacts ;
}
クライアントから同じメソッドを呼び出そうとすると、次のようなエラーが発生します
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException