Click here to Skip to main content
15,918,889 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi All

I have a page that calls a webservice like this:
C#
protected override void OnNavigatedTo(NavigationEventArgs e)
       {
           getlistSoapClient getlistMgrs = new getlistSoapClient();
           getlistMgrs.getlistofMgrsCompleted += new EventHandler<getlistofMgrsCompletedEventArgs>(getlistMgrs_getlistofMgrsCompleted);
           getlistMgrs.getlistofMgrsAsync();
       }
       void getlistMgrs_getlistofMgrsCompleted(object sender, getlistofMgrsCompletedEventArgs e)
       {
           if (e.Error != null)
           {
               nextButton.Content = "Sorry: " + e.Error.Message;
           }
           else
           {
               SalesMgrCB.DataContext = e.Result;
           }

       }


and the webservice looks like this:
C#
public class getlist : System.Web.Services.WebService
    {
        public static string AllSalesMgrs;

        [Serializable]
        public class Person
        {
            public string Name { get; set; }           
        } 

        [WebMethod]
        public List<Person> getlistofMgrs()
        {
            List<Person> childrenUsers = new List<Person>();
            using (var context = new PrincipalContext(ContextType.Domain, "myhonda.ca"))
            {
                using (var searcher = new PrincipalSearcher(new UserPrincipal(context)))
                {
                    foreach (var result in searcher.FindAll())
                    {
                        DirectoryEntry de = result.GetUnderlyingObject() as DirectoryEntry;

                        childrenUsers.Add(new Person()
                        {
                            Name = de.Name
                        });
                    }
                }
            }
            return childrenUsers;
        }
    }


but when i run it i get error in the Reference.cs file that says:

There was an error while trying to deserialize parameter http://tempuri.org/:getlistofMgrsResponse. Please see InnerException for more details.

In the details, it says _args is {object[0]} and _result is null.

Right now, im just trying to get the names of all objects in the AD so I can test to see if they actually load in the Combobox, but eventually Im going to get specific groups to load in the comboboxes. But is this happening because I'm doing that? Do I need to be more specific in my Domain path?
Posted

1 solution

Put this Attribute on your WebService Class:
C#
[Serialize] 


Hope it helps.
 
Share this answer
 
Comments
Christian Amado 10-Aug-12 10:05am    
Did my answer helped to you? Or need more development?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900