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 = MCWSGateway.new() obj.wiredump_dev = STDERR obj.headerhandler << CustomSimpleHeader.new
usernametoken = UsernameToken.new("username","password",:type => 'PLAIN') obj.security.add_security_token(usernametoken)
aq = AuthorRetrieve.new("",00000,"") puts obj.retrieveAuthor(aq) end end
Thanks, Ian