[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

send cookies in SOAP call?

Chris McMahon

8/4/2006 7:22:00 PM


cross-posted to soap4r list, sorry about that:

I have some code that creates a connection to a SOAP server like so:

@soap = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver
@soap.options["protocol.http.basic_auth"] << [wsdl_url, "user",
"pass"]

I can create a valid cookie like so:

cookie = WebAgent::Cookie.new
cookie.name = 'NAME'
cookie.value = 'YES'
cookie.url = URI.parse(@@local_wsdl_url)
cookie.domain = 'lyris.com'
cookie.path = '?wsdl'
puts cookie.inspect
=>
#<WebAgent::Cookie:0x55e6338 @path="?wsdl", @domain_orig=nil,
@url=#<URI::HTTP:0x2af2f38 URL:http://localhost:82/?wsdl>, @secure=nil,
@domain="lyris.com", @value="YES", @override=nil, @discard=nil,
@use=nil, @name="NAME", @path_orig=nil>

but I can't figure out how to send the cookie with the SOAP request.
Say I call a function "apiVersion". From the examples I found, I would
expect that these lines would produce a SOAP call with a header with
the cookie, but it does not happen:

@soap.streamhandler.client.cookie_manager.add(cookie)
@query = @soap.apiVersion()

POST / HTTP/1.1
SOAPAction: ""
Content-Type: text/xml; charset=utf-8
Authorization: Basic YWRtXYZBBQG1ubw==
User-Agent: SOAP4R/1.5.5 (/114, ruby 1.8.4 (2005-12-24) [i386-mswin32])
Date: Fri Aug 04 10:40:32 Pacific Daylight Time 2006
Content-Length: 407
Host: localhost:82

and that's all the headers I have.

Any suggestions for how to get the cookie into the SOAP call?