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

Weird ComboBox Web Service Error

7 Answers 143 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 20 Feb 2009, 01:19 AM
Hi

I'm using a webservice to populate a RadComboBox.

Here is my js:

    
function OnClientItemsRequested(sender, eventArgs) {  
        var items = sender.get_items();  
 
        if (items.get_count() == 2) {  
            OpenEntityWindowFromItem(items.getItem(1), sender);  
        }  
    } 
function HandleRequestStart(sender, eventArgs) {  
        var context = eventArgs.get_context();  
        context["Filter"] = sender.get_text();  
    }  
 
    function OnClientItemsRequestFailedHandler(sender, eventArgs) {  
        alert(eventArgs.get_errorMessage());  
        // set cancel to hide the default message      
        eventArgs.set_cancel(true);  
    }  
      
    function OnClientSelectedIndexChanged(sender, eventArgs) {  
        OpenEntityWindowFromItem(eventArgs.get_item(), sender);  
    } 

        

Here is my markup (The web service path is set in codebehind):

<telerik:RadComboBox ID="uxRadComboBox" runat="server" EmptyMessage="Search..." 
     Skin="Web20" EnableEmbeddedSkins="false" 
     OnClientItemsRequesting="HandleRequestStart" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" 
     OnClientItemsRequested="OnClientItemsRequested" 
     EnableLoadOnDemand="true" OnClientItemsRequestFailed="OnClientItemsRequestFailedHandler">  
        <WebServiceSettings Method="GetSearch" /> 
    </telerik:RadComboBox> 

Here is my webservice method:

 [WebMethod]  
        public SearchComboBoxItemData[] GetSearch(object context)  
        {  
          .....  
        } 

Here is the SearchComboBoxItemData class:

public class SearchComboBoxItemData  
    {  
        public string Text { get; set; }  
        public string Value { get; set; }  
    } 

This all works fine on my local set, but on our production server when I click in the combobox, a windows explorer message box pops up saying: "There was an error processing the request."  There isn't any error published to the event viewer.  Is there anything I can do in my code to get more details about the error that is occurring, so I can fix it?

Thank You

7 Answers, 1 is accepted

Sort by
0
Accepted
Simon
Telerik team
answered on 20 Feb 2009, 08:35 AM
Hello Caleb Sandfort,

It seems that you are missing the path to the WebService in the WebServiceSettings section of the RadComboBox definition.

Could you please try setting it and see whether things work fine?

All the best,
Simon
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
Caleb Sandfort
Top achievements
Rank 1
answered on 20 Feb 2009, 03:18 PM
I'm am setting the webservice path, I'm just doing it in code behind:

protected void Page_Load(object sender, EventArgs e)  
{  
     this.uxRadComboBox.WebServiceSettings.Path = ResolveClientUrl("~/WebServices/SearchService.asmx");  
     ........  
0
Veselin Vasilev
Telerik team
answered on 23 Feb 2009, 08:05 AM
Hi Caleb Sandfort,

Please try without using the ResolveClientUrl method:

protected void Page_Load(object sender, EventArgs e)   
{   
  this.uxRadComboBox.WebServiceSettings.Path = "~/WebServices/SearchService.asmx";   
  ........   
}  


If it does not help - please send us a sample running project where we can observe the error.

Kind regards,
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
Caleb Sandfort
Top achievements
Rank 1
answered on 25 Feb 2009, 05:40 PM
I tried not using ResolveClientUrl and that didn't fix it.  I would send in a sample, but I am not able to recreate it locally, it is only our production set.

I was able to get the actual error that is being thrown:

 

Invalid web service call, missing value for parameter: 'context'.

 

0
Veselin Vasilev
Telerik team
answered on 02 Mar 2009, 09:45 AM
Hi Caleb Sandfort,

I tried to reproduce the problem but to no avail.

What is the target framework of you project and does your server have .NET 3.5 installed?
I noticed that you are using Auto-implemented properties which are available in C# 3.0+

Please find attached my sample project. It is for .Net 2.0 and does not use Auto-implemented properties. Let me know if it works on your server.

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
Caleb Sandfort
Top achievements
Rank 1
answered on 03 Mar 2009, 07:25 PM
The sample did work on my server.

I believe I have figured out what is causing my problem, but not how to fix it.

The problem is that the application uses windows authentication, and the folder containing the web service does not, it just allows anonymous access.

Normally when we would use a web service from code behind we would just set the credentials as follows:

SearchService searchService = new SearchService();

searchService.Credentials = System.Net.

CredentialCache.DefaultCredentials;

But with the RadComboBox being called from javascript, there is no way to do this.  Is there a way in javascript or the web.config to make the call to the webservice pass the right credentials?

Thanks for all your help.

 

0
Caleb Sandfort
Top achievements
Rank 1
answered on 03 Mar 2009, 09:17 PM
Hi

I've decided to forego loading items via a webservice and am just using the OnItemsRequested event.  This is serving my needs just fine.

Thanks for your time
Tags
ComboBox
Asked by
Caleb Sandfort
Top achievements
Rank 1
Answers by
Simon
Telerik team
Caleb Sandfort
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or