Sunday, November 2, 2008

Turning all JSON web services into JSONP web services

I created a very simple Google App Engine application on Friday that helps you when somebody built a JSON based web service but did not mind to make it JSONP compatible (JSONP is a standard to do cross domain AJAX requests and it is supported by all major JavaScript libraries).

To use it simply call:
http://jsonpgateway.appspot.com/?url=YOUR_URL
or:
http://jsonpgateway.appspot.com/?url=YOUR_URL&callback=YOUR_CALLBACK
to us a customized callback parameters.

Here are some working examples:
Currently only GET requests are supported, so fully restful services are off limits. However, I guess, one could put in some more code to support different request methods.

To ensure that the payload is really JSON it is parsed and reencoded on the server.

I'm not really sure whether this service is secure enough. If somebody makes a point that it should be taken down then I will.
Post a Comment