RadComboBox Web Service Serialization Error

7 posts, 0 answers
  1. Caleb Sandfort
    Caleb Sandfort avatar
    35 posts
    Member since:
    Mar 2008

    Posted 30 Jan 2009 Link to this post

    Hi

    I am trying to populate a RadComboBox with a web service and am receiving the following serialization error:

    System.InvalidOperationException Occurred.
    *********************************************
    Message: Unable to handle request.
    Data:
    TargetSite: System.Web.Services.Protocols.ServerProtocol Create(System.Type, System.Web.HttpContext, System.Web.HttpRequest, System.Web.HttpResponse, Boolean ByRef)
    HelpLink: NULL
    Source: System.Web.Services

    StackTrace Information
    *********************************************
    at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
    at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)

    2) Exception Information
    *********************************************
    Exception Type: System.InvalidOperationException
    Message: Method SearchService.GetSearch can not be reflected.
    Data:
    TargetSite: System.Web.Services.Protocols.SoapReflectedMethod ReflectMethod(System.Web.Services.Protocols.LogicalMethodInfo, Boolean, System.Xml.Serialization.XmlReflectionImporter, System.Xml.Serialization.SoapReflectionImporter, System.String)
    HelpLink: NULL
    Source: System.Web.Services

    StackTrace Information
    *********************************************
    at System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs)
    at System.Web.Services.Description.SoapProtocolReflector.ReflectMethod()
    at System.Web.Services.Description.ProtocolReflector.ReflectBinding(ReflectedBinding reflectedBinding)
    at System.Web.Services.Description.ProtocolReflector.Reflect()
    at System.Web.Services.Description.ServiceDescriptionReflector.ReflectInternal(ProtocolReflector[] reflectors)
    at System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type type, String url)
    at System.Web.Services.Protocols.DocumentationServerType..ctor(Type type, String uri)
    at System.Web.Services.Protocols.DocumentationServerProtocol.Initialize()
    at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
    at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

    3) Exception Information
    *********************************************
    Exception Type: System.InvalidOperationException
    Message: There was an error reflecting 'GetSearchResult'.
    Data:
    TargetSite: System.Xml.Serialization.MembersMapping ImportMembersMapping(System.Xml.Serialization.XmlReflectionMember[], System.String, Boolean, Boolean, Boolean, System.Xml.Serialization.RecursionLimiter)
    HelpLink: NULL
    Source: System.Xml

    StackTrace Information
    *********************************************
    at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, XmlMappingAccess access)
    at System.Web.Services.Protocols.SoapReflector.ImportMembersMapping(XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, String elementName, String elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members, Boolean validate, Boolean openModel, String key, Boolean writeAccess)
    at System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs)

    4) Exception Information
    *********************************************
    Exception Type: System.InvalidOperationException
    Message: There was an error reflecting type 'Telerik.Web.UI.RadComboBoxItemData'.
    Data:
    TargetSite: System.Xml.Serialization.TypeMapping ImportTypeMapping(System.Xml.Serialization.TypeModel, System.String, ImportContext, System.String, System.Xml.Serialization.XmlAttributes, Boolean, Boolean, System.Xml.Serialization.RecursionLimiter)
    HelpLink: NULL
    Source: System.Xml

    StackTrace Information
    *********************************************
    at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.CreateArrayElementsFromAttributes(ArrayMapping arrayMapping, XmlArrayItemAttributes attributes, Type arrayElementType, String arrayElementNs, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.ImportArrayLikeMapping(ArrayModel model, String ns, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType, Boolean rpc, Boolean openModel, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers, Boolean rpc, Boolean openModel, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter)

    5) Exception Information
    *********************************************
    Exception Type: System.InvalidOperationException
    Message: Cannot serialize member 'Telerik.Web.UI.ControlItemData.Attributes' of type 'System.Collections.Generic.IDictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]', see inner exception for more details.
    Data:
    TargetSite: Void CheckSupportedMember(System.Xml.Serialization.TypeDesc, System.Reflection.MemberInfo, System.Type)
    HelpLink: NULL
    Source: System.Xml

    StackTrace Information
    *********************************************
    at System.Xml.Serialization.StructModel.CheckSupportedMember(TypeDesc typeDesc, MemberInfo member, Type type)
    at System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo)
    at System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo)
    at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping mapping, StructModel model, Boolean openModel, String typeName, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns, Boolean openModel, XmlAttributes a, RecursionLimiter limiter)
    at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel, RecursionLimiter limiter)

    6) Exception Information
    *********************************************
    Exception Type: System.NotSupportedException
    Message: Cannot serialize member Telerik.Web.UI.ControlItemData.Attributes of type System.Collections.Generic.IDictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] because it is an interface.
    Data:
    TargetSite: NULL
    HelpLink: NULL
    Source: NULL

    The web service method trys to return an array of 

    RadComboBoxItemData


    Any help or insight would be appreciated.
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 02 Feb 2009 Link to this post

    Hi Caleb Sandfort,

    Our live example works properly in this case - could you please provide more details about your WebService's Web Method implementation?

    Alternatively you could compare the two versions - the live and yours - in order to find out what is different in your case.

    Greetings,
    Simon
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Caleb Sandfort
    Caleb Sandfort avatar
    35 posts
    Member since:
    Mar 2008

    Posted 02 Feb 2009 Link to this post

    Here's the web service method signature.:

    public

     

    RadComboBoxItemData[] GetSearch(object context)

    The method declares a list of RadComboBoxItemData:

    List

     

    <RadComboBoxItemData> result = new List<RadComboBoxItemData>();

    Adds some RadComboBoxItemData items to result and then returns:

     

    return

     

    result.ToArray();

    Another note; the RadComboBox works perfectly fine on my local machine.  But when it is deployed to our server and used, that is when the error occurs. 

     

  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 04 Feb 2009 Link to this post

    Hello Caleb Sandfort,

    Please try the suggestion in this forum post about an identical issue.

    All the best,
    Simon
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. DW Web Team Member
    DW Web Team Member avatar
    43 posts
    Member since:
    Jun 2012

    Posted 19 Aug 2009 Link to this post

    RadComboBox feed by a Web Service works great for me.  I love the performance!
    Can it be coded to return both a Key and a Value (or an ID and Text)?
    I can get the webservice (asmx) to return both, but I can't get them both attached to radcombobox.
    Thanks!

    Here's a snip-it of code...

     

    <telerik:RadComboBox ID="cboEmployee" runat="server" EmptyMessage="Search for Employee..." 
        EnableEmbeddedSkins="false" Filter="Contains" EnabelItemCaching="true" AllowCustomText="true" 
        EnableLoadOnDemand="true">  
        <WebServiceSettings Path="cboEmployee.asmx" Method="GetEmployees" /> 
    </telerik:RadComboBox> 

    [WebMethod]  
    public IEnumerable GetEmployees()  
    {  
        List<Employee> items = new List<Employee>();  
     
        Receivable.EmployeeDataTable timbo1 = ReceivablePC.GetWWREmployees();  
        for (int i = 0; i < timbo1.Count; i++)  
        {  
            Employee itemData = new Employee();  
            itemData.ID = timbo1[i].EmployeeKeyID.ToString();  
            itemData.Text = timbo1[i].EmployeeName;  
            items.Add(itemData);  
        }  
     
        //List<Receivable.EmployeeRow> list = ReceivablePC.GetWWREmployees().AsEnumerable().ToList();  
        return items;  
    }  
     
    class Employee  
    {  
        private string id;  
        private string text;  
     
        public string ID  
        {  
            get { return id; }  
            set { id = value; }  
        }  
     
        public string Text  
        {  
            get { return text; }  
            set { text = value; }  
        }  

  7. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 20 Aug 2009 Link to this post

    Hi ,

    Please rename your ID property to Value and it should be automatically mapped to the Value property of the RadComboBoxItem.

    All the best,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. DW Web Team Member
    DW Web Team Member avatar
    43 posts
    Member since:
    Jun 2012

    Posted 20 Aug 2009 Link to this post

    Worked a treat.  Thanks!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017