Net::HTTP proxying 3rd party services for xmlhttp requests

Hello, I was wondering if anyone had solved this issue before.

Basically I am calling a 3rd party information service using Net::HTTP which I would like to proxy through my Rails app so that I can access it via an xmlhttp request using JavaScript.

This service is not 100% reliable so while I can set a small timeout, while the service is being pinged it stops all the other processes from being run. I would like to set it up so that it happens as a background process and then after a certain amount of time pops up.

I have tried the following, but all that happens is that Rails complains that it can't find a template.

  def index     wgw_server = WGWServer.new     Thread.new {       render :text => wgw_server.proxy(params[:id] + '?' + request.env['QUERY_STRING'], params[:callback], params[:callbackParam])     }   end

wgw_server.proxy contains the code which handles the Net::HTTP request.

Any ideas?

Thanks