SendingCookie
(from soap4r ML. Thanks)
Q
I'm trying to find example to use SOAP4r with cookies. I understood I needed to use access2, which I do, but I don't find any documentation how to send/receive cookie (I need to set a cookie to send to the server before the soap request).
A
Ok I found the answer. Using cookie and ssl with self signed certificate.
For archive :
soap = SOAP::RPC::Driver.new("https://url/","urn:something")
soap.options["protocol.http.basic_auth"] <<
["https://url/","login","pass"]
soap.options["protocol.http.ssl_config.verify_mode"] = nil
# Create cookie
cookie = WebAgent::Cookie.new
cookie.name = NAME'
cookie.value = 'YES'
cookie.url = URI.parse "https://url/"
cookie.domain = cookie.url.host
cookie.path = cookie.url.path
# add the cookie
soap.streamhandler.client.cookie_manager.add cookie
soap.streamhandler.client.debug_dev = STDERR
soap.add_method('myMethod')
soap.myMethod