# Idea taken from: http://blog.willcannings.com/2008/07/06/wsse-authentication-in-ruby-soap4r/ # See also: http://journal.dedasys.com/2009/05/08/ruby-soap4r-wsse-authentication require 'soap/header/simplehandler' class G4SIAuthHeader < CustomHeader NAMESPACE = 'http://WS.G4SI.COM/' def initialize(username, password, accessKey) @username, @password, @accessKey = username, password, accessKey super(XSD::QName.new(NAMESPACE, 'G4SIAuthentication')) end def on_simple_outbound {"Username" => @username, "Password" => @password, "AccessKey"=>@accessKey} end end