soap4r and keep-alive

I’m working on a webservice for AudioBank to provide a command line tool which can create and upload documents.

Nothing very difficult for the server ride. With Rails ActionWebService, it requires only few lines of code.

For the client side, I use soap4r. The first steps were easy. Many guys describe how they invoke their Rails webservices with soar4r like Myles Eftos does.

Things become harder when my ruby client makes two webservices invocations .. The SOAP response of the second invocation is given empty by soar4r. After a long debug session in the ruby soap library, I found that the problem comes from HttpAccess2. Its socket says that it is eof when reading the second post response ?!

I’ve looked a way to disable the keep-alive support .. The uniq solution was to override HTTP.keep_alive_enabled at the beggining of my script with :

module HTTP
  class < < self
    def keep_alive_enabled?(version)
      false
    end
  end
end

The webservice invocations work fine with this workaround. The first release of the audiobank-client script is finished.

Tags: , , , ,

Leave a Reply