PDA

View Full Version : "Invalid JSON primitive" when calling service



crosslink06
19 Sep 2011, 6:42 PM
Hi All,

I would like to update data when an event is raised. My service in charge to do that works good and set the values correctly when I invoke it via the browser but not from my app...

I get the following error:


{"Message":"Invalid JSON primitive: page.","StackTrace":" at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}

Here is the content of my event:


Ext.Ajax.request({
url: '../Service.asmx/SetNewsItemPublishStatus',
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
params: {
param1: 516,
param2: 4
},
failure: function (response) { },
success: function (response, opts) { alert('success!'); }
});


I would appreciate your help,
Thank you :)

crosslink06
19 Sep 2011, 7:01 PM
I also get the same error when I try to load more items in a list component.

The pageSize property of my data store is set to 20, by clicking on a button an event is fired and call the store.nextPage() method, but I always get: "Invalid JSON primitive.."

Do you guys have any idea about my issue?
Thank you