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

Web Service .asmx returns null

3 Answers 284 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Timothy
Top achievements
Rank 1
Timothy asked on 03 Jan 2012, 11:08 PM
Running VS2010 (SP1) using the latest Telerix Q3 2011 controls, ASP.NET version 4, AjaxControltoolkit version 4 on a Windows 2008 R2 installation.
I am using a web service:-
   [ScriptService]
   [WebService(Namespace = "http://tempuri.org/")]
   [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
   public class PS_AdminWebInterface : System.Web.Services.WebService
   {
      [WebMethod(EnableSession = true)]
      public string[] GetSessionString(string sessionKey)
      {
         string[] results = new string[2];
         results[0] = sessionKey;
         try
         {
            if (Session["ClientID"].ToString() == "0")            //Logged in users only
            {
               results[1] = "";
               Session["ErrorOccurred"] = true;
            }
            else if (Session[sessionKey] == null)       //Does key exist
            {
               results[1] = "";
               Session["ErrorOccurred"] = true;
            }
            else
               results[1] = Session[sessionKey].ToString();
         }
         catch
         {
            results[1] = "";
         }
         return results;
      }
}

I have debugged the web service call and it is definitely being called and no exception is raised - however the javascript call :-
PlumSoftware.PS_AdminWebInterface.GetSessionString(ps_interface_sessionKey, GetSessionString, OnTimeOut, OnServiceError);

fails in the following function:-
function GetSessionString(result)
{
   if (result[1] != "0")
   {          //Data changed
      ps_interface_keepalive = 0; //Reset keepalive
      __doPostBack(ps_interface_postbackcontrol.value, result[1]);
   }
}

the result returned is always null

I have spent a few hours looking through your forums but have found no clues as to why this would be happening.

3 Answers, 1 is accepted

Sort by
0
Accepted
Veli
Telerik team
answered on 04 Jan 2012, 09:05 AM
Hi Timothy,

The code you provided seems OK and I cannot spot what might be the issue here. If you can open a support ticket and submit a sample project demonstrating this issue, our support staff will be happy to look into this.

Veli
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Timothy
Top achievements
Rank 1
answered on 05 Jan 2012, 12:25 AM
Hi - fired up Ie9 developer tools to have a peek a what was being sent back from the web service. In the production environment the response body looks like :-
{"d":["ChargeDataChanged","0"]}
in the development environment where I am testing the Telerik framework it comes back as :-
‹      ì½`I–%&/mÊ{JõJ×àt¡€`$ؐ@ìÁˆÍæ’ìiG#)«*ÊeVe]f@Ì흼÷Þ{ï½÷Þ{ï½÷º;N'÷ßÿ?\fdlöÎJÚÉž!€ªÈ?~|?"~—?ö7ø5ðü:¿Æ÷÷ÿúÀïtögüî¿ðîâŸùÅàw~ÅwþÍÿ¨ý‹ƒ?èø-·ëOú=³ÿîþ£þùÿâOùï~çâó¿ó×~ëþgòŸÌ¿þÛüžÿÜÿçÿ}¿ò?øÅÿãß/ÿü=‡þ‹åøÿ¿ïùì×,ÿ×á;ÿÎ?ýü®Ð_óOý.¿Ç/ý™ßå÷øè—þÏŸÿ­â/ø%ÿã_ú§þ-ÿÔŸùßÿ¹“?ù¼þ¥ÿÁößþ—þ‰Gÿûÿu÷Wý¿Ö¯ñküßÿ÷PüÓßù×ø5~ÿ'  ÿÿ~ÊE¿š  

It seems like the response body is coming back compressed with gzip, I have turned off Static and Dynamic compression at both the server level and the site level but the response still comes back compressed - what am I missing??
0
Timothy
Top achievements
Rank 1
answered on 05 Jan 2012, 02:07 AM
Hi - after further investigation I found an old module that I used to compress json requests and responses - once this was removed everything worked fine.
Tags
Ajax
Asked by
Timothy
Top achievements
Rank 1
Answers by
Veli
Telerik team
Timothy
Top achievements
Rank 1
Share this question
or