SOAP request formed correctly the first time, extra env:Header/ tag added on subsequent invocations

I have the following code in a controller. New to Rails, so please
tell me if I’m doing something here that should be in a different part
of the application. The weird thing is that this code works fine ONCE,
the first pageload after starting up the application. Every subsequent
pageload produces a “org.xml.sax.SAXException: Only one Header element
allowed!” error from the remote webservice. Looking at the XML
wiredumps, the SOAP request sent the first time is correct, but on
subsequent executions the SOAP request has an extra env:Header/ (with
the / at the END of the tag) tag right before the env:Body tag.

class GethelpnowController < ApplicationController
def index
require ‘wss4r/rpc/wssdriver’
require ‘customsimpleheader’

obj =
obj.wiredump_dev = STDERR
obj.headerhandler <<

usernametoken ="username","password",:type =>


aq ="",00000,"")
puts obj.retrieveAuthor(aq)