JSONRPC servlet support?

171 views
Skip to first unread message

kenny

unread,
Aug 19, 2006, 4:56:43 PM8/19/06
to Google Web Toolkit
Our server-side development team is using oss.metaparadigm.com
JSONRPCServlet, is there anyone who has the experience and code to
share?

P.S. This servlet is only taking http post with the payload(method +
params) encoded with json. metaparadigm also distributed a client side
jsonrpc.js. I guess I am looking for example with JSNI, right?

Thanks

Florian

unread,
Aug 20, 2006, 1:37:34 PM8/20/06
to Google Web Toolkit
Technically my json-rpc implementation for GWT should work as both
follow the same standard. But i have not actually tested my
implementation with JSON-RPC-Java.
Anyway, you can download gwt-json-rpc at

http://ffxml.net/gwt-json-rpc.html

Florian

Florian

unread,
Aug 20, 2006, 2:13:14 PM8/20/06
to Google Web Toolkit
Me again. Just for curiosity I did a simple test with JSON-RPC-Java on
the server side and it worked well. You can download my test project
at:

http://ffxml.net/assets/files/json-rpc-java-test.zip

Florian

kenny

unread,
Aug 21, 2006, 10:45:09 AM8/21/06
to Google Web Toolkit
Florian:
This is exactly what I am looking for and thanks for sharing your code.
I'll try them out against
http://oss.metaparadigm.com/jsonrpc-cvs/unit.jsp. Wish GWT can
incorporate your contributions so that the rest of us don't need to
multiple sources and copyrights.
Thanks again,
Kenny

kenny

unread,
Aug 21, 2006, 1:04:32 PM8/21/06
to Google Web Toolkit
Florian:
Couple of things to check w/ you.
1. since the HashMap does not ensure the key order, the resulting
encoded json string would have
params, method, id in any arbitrary order. I used ethereal to examine
the http packet, the oss demo pages always sent out the order id,
method, params. Is this ok?
2. the id value seems to be 0 all the time, should it be set to the
requestCounter?

I ran my test in hosted mode. I tried with
oss.metaparadigm.com/jsonrpc-cvs/hello.jsp and kept gettng error: 404.
I'm not sure if this is related to the session the jsp page expected?

Florian

unread,
Aug 21, 2006, 4:15:06 PM8/21/06
to Google Web Toolkit
Hi!

kenny wrote:
> Florian:
> Couple of things to check w/ you.
> 1. since the HashMap does not ensure the key order, the resulting
> encoded json string would have
> params, method, id in any arbitrary order. I used ethereal to examine
> the http packet, the oss demo pages always sent out the order id,
> method, params. Is this ok?

The order of object properties does not matter because you only can
access them by name, not by index. So it's ok.

> 2. the id value seems to be 0 all the time, should it be set to the
> requestCounter?

It works as long as you don't share callback objects between different
requests. Even with concurrent requests it works that way.
I always create a new callback object for each request, so it did not
bother me yet. Is this a problem in your case?

>
> I ran my test in hosted mode. I tried with
> oss.metaparadigm.com/jsonrpc-cvs/hello.jsp and kept gettng error: 404.
> I'm not sure if this is related to the session the jsp page expected?

Because the JSONRPCServlet is located at this URL, if I am right:

http://oss.metaparadigm.com/jsonrpc-cvs/JSON-RPC

But even with this URL I did not get it working. I always got an error
"...method not found..." or similar. I can't figure out what the
problem is. And with my own JSONRPCServlet it worked. So i did not
investigate this any longer.

Florian

kenny

unread,
Aug 21, 2006, 7:43:42 PM8/21/06
to Google Web Toolkit
1. I think you are right - the ordering of the member objects is not
important with JSON;
2. I used ethereal to examine the contents of http packets being sent
to the server; the "id" value do get incremented throughtout the life
cycle of the http session. Just to be consistent, I will make the
adjustment locally.
3. don't worry about this. I was hoping the servlet will respond
without checking the session value;

Thanks again for your help.
- Kenny

kenny

unread,
Aug 28, 2006, 4:14:54 PM8/28/06
to Google Web Toolkit
Florian:
Deploy your javajson sample to my jboss server and kept getting the
following error.
Error: java.lang.RuntimeException:
com.google.gwt.core.client.JavaScriptException: JavaScript SyntaxError
exception: Syntax error
In addition to change the classpaths, I just add the set of classes
under gwt-json-rpc/src/net.ffxml.gwt.json.client to javajson project.
What did I do wrong?
- Kenny

kenny

unread,
Aug 28, 2006, 6:04:41 PM8/28/06
to Google Web Toolkit
Florian:
Never mind. I tracked down my problem. The URL to which the jsonRpc
is pointing to '/JSON-RPC' and it should have been
'/nameOfWarFile/JSON-RPC'.
The exception was because the http.post returned a 404.
Now, it worked the way I expected. Thank you.

- Kenny

Reply all
Reply to author
Forward
0 new messages