简体   繁体   中英

Web Services client issue

I have a single WebMethod which will return List object as shown below

[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 ;
        }

When I try to invoke the same method from client I am getting an error as follows

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException

MSDN has an article for troubleshooting xml serialization issues. There's too much info to post here. I'd start at their article here .

However, step 1 should be to try to get to the Inner Exception, which should be more specific.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM