For reasons I won't get into (business, politics, and AJAX), I discovered today that I needed to convert an XML-RPC server to a JSON-RPC server. I looked at several implementations and they were either not general enough for my use, or they were horrible.
So, I hacked a copy of twisted.web.xmlrpc and turned it into jsonrpc using the simplejson library. Right now, it's doing JSON over HTTP, but I fully intend to write a TCP implementation as well. The problem, though, is this: as I was putting this together today, all I could think about was ways to make the code general enough to provide a common basis for use in implementing *-RPC. Ah, down that path lies madness. And it's one of those things you just can't avoid thinking about...
I'm currently writing some twisted.trial tests for it, but I also need to add some more stuff to make this generally useful (not to mention easier to debug). Hmmm, I'm actually really looking forward to doing a twisted TCP implementation of JSON-RPC. That should be fairly fast. And clean. Maybe.
And, of course, I'm sure I'll do a twisted.web2 implementation as well.
I have an amazing headache now, and need to get some food.
Update: All twisted.trial tests are passing and I am running a twisted JSON-RPC server now.
Update: For those wanting to use this code, please read the comments on this entry (dated May 5, 2006) and then see this post.
Technorati Tags: jsonrpc, json, python, twisted, web, xmlrpc