For some reason my webservice does not like the data I'm sending it. I keep getting the following error:
System.InvalidOperationException: Request format is invalid: text/xml; charset=utf-8.
at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
Any ideas?
Here's my code:
$.ajax({
type: "POST",
url: "/wsCheckout.asmx/loginUser",
data: "userName=" + userName + "&pw=" + pw,
contentType: "text/xml; charset=utf-8",
dataType: "xml",
cache: false,
beforeSend: function(n){ showLoading(); },
complete: function(n){ hideLoading(); },
success: function(r) {
if( checkResponse(r) == true ){
closeBox(aspxIdPrefix + "login");
hideBox(aspxIdPrefix + "login");
openBox("#shippingAddress");
}
} // end success
}); //end AJAX
[WebMethod(EnableSession = true)]
[System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Xml)]
public DataTable loginUser(string userName, string pw)
{
......
}