rubysoapvmwaresoap4r

How do I set a cookie in for a soap request?


This is the first time I am getting with soap (Ruby's soap4r). I am trying to develop and plugin for vShpere Client. (ruby sdk http://communities.vmware.com/thread/162318).

I would like to know how I can set a cookie for a SOAP request ?


Solution

  • Found a way to do it.

    driver = SOAP::RPC::Driver.new('x','y','c')
    cookies = driver.streamhandler.client.cookie_manager.cookies
    cookie = cookies[0]
    cookie.value = <value>
    

    That does it, it might be a bad hack, but works reliably enough.