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

I was wondering if anyone had solved this issue before.

Basically I am calling a 3rd party information service using
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 = {
      render :text => wgw_server.proxy(params[:id] + '?' +
request.env['QUERY_STRING'], params[:callback],

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

Any ideas?