I calling a local asp.net web service via an jquery ajax call. I'm getting an error, which in Fiddler comes back as {"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}. I have several other web services similar to the one giving an error that work fine, the only difference between them is the one in question returns a string value. I can run the web service from visual studio and it works fine. I can run the stored procedure that's called in the web service and it works fine. I thought it might have been a problem with the data syntax in the ajax call so I hard coded the value in web service. I've changed the entity framework function import call to return both "none" and "string" without change. I did remember to uncomment the json call in the web service. At this point I'm at a loss.
I would appreciate it if someone could look at the code and see if there are any glaring mistakes or offer some advise of what else to check.
Thanks,
Tom
[System.Web.Script.Services.ScriptService]
public class wsDeptServices : System.Web.Services.WebService {
sfhsEntities ctx = new sfhsEntities();
public wsDeptServices () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
[WebMethod]
public String GetApparatusStationLocaion(int ID)
{
using (sfhsEntities context = new sfhsEntities())
{
System.Data.Objects.ObjectParameter AoutputParameter = new System.Data.Objects.ObjectParameter("StationDesc", typeof(String));
ctx.GetApparatusStationLocation(ID, AoutputParameter);
return (String)AoutputParameter.Value;
}
}
}
var pageUrl = '<%=ResolveUrl("~/wsGetDefCount.asmx")%>'
$.ajax({
type: "POST",
url: pageUrl + "/GetApparatusTroubleTicketCountByID",
data: "{ 'ID': '" + $("#txtCurID").val() + "' }",
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (msg) {
//alert('In ' + msg.d);
$("#txtTTID").val(msg.d);
},
error: OnError
});