Basic implementation of xml to jsonp proxy server. Implemented with Java Servlets.
Source code: xml2jsonp.zip.
Apache maven is used to build and run the application. Steps:
- download and install maven
- download and extract xml2jsonp.zip
- go to the extracted directory and from command line run 'mvn jetty6:run' (this will compile the source code, create a war file, download and start embedded servlet container - jetty, deploy and run the proxy server)
- url of the proxy server is: http://<hostname>:8080/xml2jsonp/Xml2JsonpProxyServlet
Only HTTP GET method is supported.
- 'url' - url of the target server that outputs XML (e.g. RSS or Atom)
- 'cookie' - name value pair that will be send to the target server as a cookie; the request can contain zero, one or many 'cookie' parameters
Whole xml document is loaded into memory. It is then transformed to json format. This won't scale too well with increasing number of users and bigger xml documents. Better solution would be to stream the xml document and transform it incrementally.