To the ruby/soap experts around...
How do i control/model the unmarshalling behaviour of the Zimbra SOAP response in the code snippet bellow in order to get not an array with (only) the 'values' on zimbra, but an hash with pairs (variable, value) ?
Code:
#!/usr/bin/ruby
require 'soap/rpc/driver'
require 'soap/driver'
require 'soap/header/simplehandler'
class ClientAuthHeaderHandler < SOAP::Header::SimpleHandler
MyHeaderName = XSD::QName.new("urn:zimbra", "context")
def initialize(sessionid = nil, authtoken = nil)
super(MyHeaderName)
@sessionid = sessionid
@authtoken = authtoken
end
def on_simple_outbound
if @sessionid
{ "sessionId" => @sessionid, "authToken" => @authtoken }
end
end
end
drv = SOAP::RPC::Driver.new('https://zimbra:7071/service/admin/soap/', 'urn:zimbraAdmin')
drv.wiredump_dev = STDERR #if $DEBUG
drv.options["protocol.http.ssl_config.verify_mode"] = nil
drv.add_method('GetAllAdminAccountsRequest')
drv.add_method('AuthRequest',"name", "password")
token, lifetime, sessionid = drv.AuthRequest('admin@zimbra,'zimbra')
drv.headerhandler << ClientAuthHeaderHandler.new(sessionid, token)
response = drv.__send__(:GetAllAdminAccountsRequest)
p response
p response.a Thanxs in advance and best regards... Have a nice weekend