Web服务客户端问题

时间:2010-08-19 03:29:27

标签: c# web-services soap webservice-client

我有一个WebMethod,它将返回List对象,如下所示

[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

1 个答案:

答案 0 :(得分:0)

MSDN有一篇文章可以解决xml序列化问题。这里发布的信息太多了。我将从他们的文章here开始。

但是,第1步应该是尝试进入内部异常,这应该更具体。

相关问题