This is a migrated thread and some comments may be shown as answers.

RadComboBox Web Service Serialization Error

6 Answers 225 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Caleb Sandfort
Top achievements
Rank 1
Caleb Sandfort asked on 30 Jan 2009, 11:07 PM
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.

6 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 02 Feb 2009, 01:10 PM
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.
0
Caleb Sandfort
Top achievements
Rank 1
answered on 02 Feb 2009, 08:37 PM
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. 

 

0
Simon
Telerik team
answered on 04 Feb 2009, 04:36 PM
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.
0
DW Web Team Member
Top achievements
Rank 2
answered on 19 Aug 2009, 11:58 AM
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; }  
    }  

0
Veselin Vasilev
Telerik team
answered on 20 Aug 2009, 12:09 PM
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.
0
DW Web Team Member
Top achievements
Rank 2
answered on 20 Aug 2009, 12:24 PM
Worked a treat.  Thanks!
Tags
ComboBox
Asked by
Caleb Sandfort
Top achievements
Rank 1
Answers by
Simon
Telerik team
Caleb Sandfort
Top achievements
Rank 1
DW Web Team Member
Top achievements
Rank 2
Veselin Vasilev
Telerik team
Share this question
or