ASMX Service call showing undefined result in javascript

mixloads31

New Member
I have an ASP.NET site that has some ajax SOAP web services in ASMX files like this:\[code\][WebService(Namespace = "http://mynamespace")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][ScriptService]public class TimeTrackingService : WebService { [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Xml)] public XmlDocument GetEmployeeTimeData(string startdate, string user) { return new XmlDocument(); }}\[/code\]On the page that I want to call the service from javascript, I use the \[code\]ScriptManagerProxy\[/code\] to generate some helper Javascript to call it:\[code\]<asp:ScriptManagerProxy runat="server" ID="scriptManager"> <Services> <asp:ServiceReference Path="~/WebServices/TimeTrackingService.asmx" /> </Services></asp:ScriptManagerProxy>\[/code\]And finally, I call it in javascript like this:\[code\]WebServices.TimeTrackingService.GetEmployeeTimeData(startdate, user, successCallback, errorCallback);\[/code\]The problem is that when the javascript success callback is executed, the result is undefined. I've stepped through the server code and verified that it's returning a proper XML document, and used Fiddler to verify that it's really getting sent to the client. I don't know why it would end up null in the javascript code. (Side note: this code used to work, so the overall architecture is sound.)Here's the request that Fiddler captured: \[code\]POST http://localhost:49621/WebServices/TimeTrackingService.asmx/GetEmployeeTimeData HTTP/1.1Accept: */*X-Requested-With: XMLHttpRequestContent-Type: application/json; charset=utf-8Referer: http://localhost:49621/Accept-Language: en-USAccept-Encoding: gzip, deflateUser-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)Host: localhost:49621Content-Length: 63DNT: 1Connection: Keep-AlivePragma: no-cacheCookie: ASP.NET_SessionId=swsjmcfv3q32izyt3ckie1ms{"startDate":"12/23/2012","user":"myusername"}\[/code\]Response (was GZIP'd; I've decompressed):\[code\]HTTP/1.1 200 OKCache-Control: private, max-age=0Content-Type: text/xml; charset=utf-8Vary: Accept-EncodingServer: Microsoft-IIS/8.0X-AspNet-Version: 4.0.30319X-SourceFiles: =?UTF-8?B?QzpcVXNlcnNcamFja3NvbmhcTWVyY3VyaWFsXE9kZWhOZXRcV2ViU2VydmljZXNcVGltZVRyYWNraW5nU2VydmljZS5hc214XEdldEVtcGxveWVlVGltZURhdGE=?=Persistent-Auth: trueX-Powered-By: ASP.NETDate: Fri, 28 Dec 2012 20:31:52 GMTContent-Length: 6640<?xml version="1.0" encoding="utf-8"?><timedata pdfexists="false" xmlns="http://mynamespace"></timedata>\[/code\]
 
Back
Top