From: Tadeusz Bochan Date: 2006-08-31T18:20:30+09:00 Subject: Re: SOAP/WSDL/BETFAIR Hi Gianfranco, Have you updated the soap module ? I haven't had enough web experience to comment on anything being normal in this game ! ;-) I spent most of yesterday evening with this, and, thanks to Hiroshi's contribution, it works great ! I downloaded the latest tarball as per Hiroshi's instruction , unzipped it, (its a .tar.gz file, so I had some difficulty locating the right tools for unzipping it in windows ... I used 7zip in the end). Did a 'ruby install.rb' in the extracted directory, and VOILA! my script worked! I found one small problem for which I have a workaround. It is because the Betfair xml defines a method called 'id' ----------- a= status.result.eventTypeItems.eventType.collect do |market| [market.name,market.id] end ----------- Unfortunately this name clashes with Ruby's 'id' method as in Object.id Ruby warns that Object.id is 'deprecated' and that you should use Object.object_id instead. So the wrong value is returned from 'market.id'. I don't know how to get around this problem, other than substituting 'id=' for 'mktid=' in the xml first, or extracting the data manually. eg., status=soap.getAllEventTypes(:request=>apiRequestHeader) a= status.result.eventTypeItems.eventType.collect do |s| b=s.inspect[2..-2].split("{}")[1..-1].collect {|x| eval(x)} [b[1],b[0]] end (ugly, eh?) Anyway, it's all going in the right direction. I will keep you posted on any further issues I find. Cheers, Tad Gianfranco Cecconi wrote: > Worked for the great part of the evening on this. My feeling is that the > problem is with the web services that require complex types as input, as > the omnipresent apiRequestHeader . > > This source: > > --- > (...) > print "Trying to keep it alive... " > apiRequestHeader = { :clientStamp => "foo", > :sessionToken => "bar" } > response = soapDriver.keepAlive(:request => { :header => > apiRequestHeader }) > exit unless response.result.apiVersion != "" > puts "done." > (...) > --- > > makes ruby produce the following message; the parameters have > disappeared! > > --- > <- "POST /betex-api-public-ws/v2/BFService HTTP/1.1\r\nAccept: > */*\r\nContent-Type: text/xml; charset=utf-8\r\nUser-Agent: > SOAP4R/1.5.5\r\nSoapaction: \"keepAlive\"\r\nContent-Length: > 393\r\nHost: api.betfair.com\r\n\r\n" > <- "\n xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n > xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"\n > xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n \n > xmlns:n1=\"http://www.betfair.com/publicapi/BFServiceV2/\">\n > \n \n \n > \n" > -> "HTTP/1.1 200 OK\r\n" > (...) > --- > > Is it normal? > > Giacecco -- Posted via http://www.ruby-forum.com/.