views:

499

answers:

1

Hi quick question about Jayrock... I have a Jayrock JSON-RPC web service that generally works fine. However, when I try to post to my jqGrid editUrl, Jayrock throws an error. The web service works fine in other situations.

Anyone have a clue why Jayrock doesn't like the following request? Perhaps a way to configure Jayrock to accept this request?

Request:

POST /StoryManager/StoryManager.ashx/setPageItemRoles HTTP/1.1

Host: localhost:2064

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729)

Accept: */*

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

Content-Type: application/x-www-form-urlencoded; charset=UTF-8

X-Requested-With: XMLHttpRequest

Referer: http://localhost:2064/StoryManager/PageItemDetail.aspx

Content-Length: 183

Cookie: ASP.NET_SessionId=uycy1qmowzzqhiac1kg3e455

Pragma: no-cache

Cache-Control: no-cache

title=Narrative&assignedto=dfghdfgh&assigned=2009-06-25T14%3A52%3A24.0868931-05%3A00&due=2009-08-02T14%3A52%3A24.0868931-05%3A00&completed=2009-07-17T14%3A52%3A24.0868931-05%3A00&id=3

Response:

{"id":null,"error":{"name":"JSONRPCError","message":"Found String where Object was expected.","stackTrace":" at Jayrock.Json.JsonReader.ReadToken(JsonTokenClass token) in c:\Projects\Public\Jayrock\rel\rel-0.9.8316\src\Jayrock.Json\Json\JsonReader.cs:line 142\r\n at Jayrock.JsonRpc.JsonRpcDispatcher.ParseRequest(TextReader input) in c:\Projects\Public\Jayrock\rel\rel-0.9.8316\src\Jayrock\JsonRpc\JsonRpcDispatcher.cs:line 271\r\n at Jayrock.JsonRpc.JsonRpcDispatcher.Process(TextReader input, TextWriter output) in c:\Projects\Public\Jayrock\rel\rel-0.9.8316\src\Jayrock\JsonRpc\JsonRpcDispatcher.cs:line 127","errors":[{"name":"JsonException","message":"Found String where Object was expected."}]}}

+2  A: 

Because you send application/x-www-form-urlencoded request with "form-like" post data instead of application/json with correct json object.

Artyom
Thanks. I figured that out but forgot to post the answer here ;)
SoloBold