# Betfair soap problem

**URL:** <https://www.ruby-forum.com/t/betfair-soap-problem/116860>\
**Category:** Ruby\
**Created:** [October 10, 2007, 3:10pm UTC](https://www.ruby-forum.com/t/betfair-soap-problem/116860 "2007-10-10T15:10:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac91a4/32.png) [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Post date:** [October 10, 2007, 3:10pm UTC](https://www.ruby-forum.com/t/betfair-soap-problem/116860/1 "2007-10-10T15:10:45Z")

</div>

Hi. I’m trying to use the Betfair API with Ruby:-  
[http://bdp.betfair.com/exchdevelopers.php](http://bdp.betfair.com/exchdevelopers.php)

Basically, I can login to the service but I can’t do anything else - I  
keep getting a no session error? I can do something very similar below  
in php and it works fine so I think my arguments are correct. However,I  
would like to stick to ruby. I’ve seen some other posts on this but I’m  
not to clear. I’m using Ruby 1.8.6 (2007-09-24 patchlevel 111) and this  
is my irb session:-

…  
irb(main):032:0\> bfsoapclient = SOAP::WSDLDriverFactory.new( wsdl  
).create\_rpc\_driverignored attr: {}abstract  
ignored attr: {}nillable  
ignored attr: {}mixed  
=\>  
#\<SOAP::RPC::Driver:#SOAP::RPC::Proxy:https://api.betfair.com/global/v3/BFGlobalService\>

irb(main):033:0\> bflogin = bfsoapclient.login(:request=\>logindetails)  
=\> #\<SOAP::Mapping::Object:0x…fdbd49328  
{[http://www.betfair.com/publicapi/v3/BFGlobalService/](http://www.betfair.com/publicapi/v3/BFGlobalService/)}Result=#\<SOAP::Mapping::Object:0x…fdbd491fc  
{}header=#\<SOAP::Mapping::Object:0x…fdbd49026 {}errorCode=“OK”  
{}minorErrorCode=#SOAP::Mapping::Object:0x..fdbd48900  
{}sessionToken=“MMrLImJigs0OO0u3K5gty8qSPIbwFaZwRyzzLnmOEjo=”  
{}timestamp=“2007-10-10T12:58:04.062Z”\> {}currency=“GBP”  
{}errorCode=“OK” {}minorErrorCode=#SOAP::Mapping::Object:0x..fdbd46b3c  
{}validUntil=“0001-01-01T00:00:00.000Z”\>\>

irb(main):034:0\> apiRequestHeader = { :clientstamp =\> 0,:sessionToken =\>  
bflogin.result.header.sessionToken }  
=\> {:clientstamp=\>0,  
:sessionToken=\>“MMrLImJigs0OO0u3K5gty8qSPIbwFaZwRyzzLnmOEjo=”}

irb(main):035:0\> events = bfsoap.getActiveEventTypes(:request =\>  
{:header=\>apiRequestHeader})  
=\> #\<SOAP::Mapping::Object:0x…fdbd3689a  
{[http://www.betfair.com/publicapi/v3/BFGlobalService/](http://www.betfair.com/publicapi/v3/BFGlobalService/)}Result=#\<SOAP::Mapping::Object:0x…fdbd3671e  
{}header=#\<SOAP::Mapping::Object:0x…fdbd36534 {}errorCode=“NO\_SESSION”  
{}minorErrorCode=#SOAP::Mapping::Object:0x..fdbd35d82  
{}sessionToken=#SOAP::Mapping::Object:0x..fdbd3585a  
{}timestamp=“2007-10-10T13:00:25.199Z”\>  
{}eventTypeItems=#SOAP::Mapping::Object:0x..fdbd34996  
{}minorErrorCode=#SOAP::Mapping::Object:0x..fdbd344b4  
{}errorCode=“API\_ERROR”\>\>

---

<div class="post-metadata">

**Author:** ![mrpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac91a4/32.png) [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Post date:** [October 11, 2007, 11:57am UTC](https://www.ruby-forum.com/t/betfair-soap-problem/116860/2 "2007-10-11T11:57:51Z")

</div>

Many thanks for answering quickly but still the same problem after  
adding:-

Please download the WSDL as a local file, then add the following change;

\<xsd:schema  
targetNamespace=“[http://www.betfair.com/publicapi/types/global/v3/](http://www.betfair.com/publicapi/types/global/v3/)”\>

=\>

\<xsd:schema  
elementFormDefault=“qualified”  
targetNamespace=“[http://www.betfair.com/publicapi/types/global/v3/](http://www.betfair.com/publicapi/types/global/v3/)”\>

(add “elementFormDefault” line)

Please see irb output below:-

irb(main):010:0\> wsdl\_url=“BFGlobalService.wsdl”=\>  
“BFGlobalService.wsdl”  
irb(main):011:0\> soap = SOAP::WSDLDriverFactory.new( wsdl\_url  
).create\_rpc\_driverignored attr: {}abstract  
ignored attr: {}nillable  
ignored attr: {}mixed  
=\>  
#\<SOAP::RPC::Driver:#SOAP::RPC::Proxy:https://api.betfair.com/global/v3/BFGlobalService\>  
irb(main):012:0\>  
logindetails={:locationId=\>0,:password=\>“**“,:productId=\>82,:username=\>“showaprofit”,:vendorSoftwareId=\>0,:ipAddress=\>“82.69.38.122”  
}  
=\> {:productId=\>82, :username=\>“showaprofit”, :vendorSoftwareId=\>0,  
:ipAddress=\>“82.69.38.122”, :password=\>”**”, :locationId=\>0}  
irb(main):013:0\> response=soap.login(:request=\>logindetails)=\>  
#\<SOAP::Mapping::Object:0x…fdbde4da0  
{[http://www.betfair.com/publicapi/v3/BFGlobalService/](http://www.betfair.com/publicapi/v3/BFGlobalService/)}Result=#\<SOAP::Mapping::Object:0x…fdbde4c88  
{}header=#\<SOAP::Mapping::Object:0x…fdbde47b0 {}errorCode=“OK”  
{}minorErrorCode=#SOAP::Mapping::Object:0x..fdbde313a  
{}sessionToken=“gyfLobWGRgPw+mHI6hD67i49xGJ9nddrywn/hmYn9Hg=”  
{}timestamp=“2007-10-11T09:51:05.569Z”\> {}currency=“GBP”  
{}errorCode=“OK” {}minorErrorCode=#SOAP::Mapping::Object:0x..fdbde03f4  
{}validUntil=“0001-01-01T00:00:00.000Z”\>\>  
irb(main):014:0\> apiRequestHeader={:clientStamp =\> 0,:sessionToken =\>  
response.result.header.sessionToken}=\>  
{:sessionToken=\>“gyfLobWGRgPw+mHI6hD67i49xGJ9nddrywn/hmYn9Hg=”,  
:clientStamp=\>0}  
irb(main):015:0\> response=soap.getActiveEventTypes(:request  
=\>{:header=\>apiRequestHeader})=\> #\<SOAP::Mapping::Object:0x…fdbdbb702  
{[http://www.betfair.com/publicapi/v3/BFGlobalService/](http://www.betfair.com/publicapi/v3/BFGlobalService/)}Result=#\<SOAP::Mapping::Object:0x…fdbdbb23e  
{}header=#\<SOAP::Mapping::Object:0x…fdbdbad8e {}errorCode=“NO\_SESSION”  
{}minorErrorCode=#SOAP::Mapping::Object:0x..fdbdb9fce  
{}sessionToken=#SOAP::Mapping::Object:0x..fdbdb9ace  
{}timestamp=“2007-10-11T09:54:06.142Z”\>  
{}eventTypeItems=#SOAP::Mapping::Object:0x..fdbdb7580  
{}minorErrorCode=#SOAP::Mapping::Object:0x..fdbdb640a  
{}errorCode=“API\_ERROR”\>\>  
irb(main):016:0\>

---

<div class="post-metadata">

**Author:** ![mrpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac91a4/32.png) [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Post date:** [October 11, 2007, 3:28am UTC](https://www.ruby-forum.com/t/betfair-soap-problem/116860/3 "2007-10-11T03:28:02Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

Peter Aszkenasy wrote:

> Hi. I’m trying to use the Betfair API with Ruby:-  
> [http://bdp.betfair.com/exchdevelopers.php](http://bdp.betfair.com/exchdevelopers.php)

> irb(main):034:0\> apiRequestHeader = { :clientstamp =\> 0,:sessionToken =\>  
> bflogin.result.header.sessionToken }  
> =\> {:clientstamp=\>0,  
> :sessionToken=\>“MMrLImJigs0OO0u3K5gty8qSPIbwFaZwRyzzLnmOEjo=”}

clientstamp =\> clientStamp

I don’t think it causes the server error ‘NO\_SESSION’ though.

> irb(main):035:0\> events = bfsoap.getActiveEventTypes(:request =\>  
> {:header=\>apiRequestHeader})

Please download the WSDL as a local file, then add the following change;

\<xsd:schema  
targetNamespace=“[http://www.betfair.com/publicapi/types/global/v3/](http://www.betfair.com/publicapi/types/global/v3/)”\>

=\>

\<xsd:schema  
elementFormDefault=“qualified”  
targetNamespace=“[http://www.betfair.com/publicapi/types/global/v3/](http://www.betfair.com/publicapi/types/global/v3/)”\>

(add “elementFormDefault” line)

And please try to use the WSDL to see how it goes?

- From example XML messages of the site, they seems to expect ‘header’  
element Namespace qualified but the WSDL does not define  
‘elementFormDefault’ to ‘qualified’. I think it’s just a bug of the  
WSDL because the definition for targetNamespace  
‘[http://www.betfair.com/publicapi/v3/BFGlobalService/](http://www.betfair.com/publicapi/v3/BFGlobalService/)’ in the WSDL has  
elementFormDefault=‘qualified’.

Regards,  
// NaHi

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRw18XB9L2jg5EEGlAQIBugf/Xh5060A6y8il9xewTOyEj4EXrCIDxDi9  
kyhdLDJBLJEymY+WT1/bGH7e3LimsQTNn3wJwpnSKfTWaoTXcJLI6pYoVgPUcEsS  
fk23godkL8lOv1J+DpPYGybXfCBWzLZgRgVNjCCjWKcRGgWuTc04pnxA3Gr3NMNg  
1GAwclmER9OsTRs1/5ZbluG/fZPGO9egoBSUTECKOpdKPEqB53kazi0HTm+flbnM  
nSwucDp2VBd/5X2NtsxUTUJw3RZSv+wWcIH8ugUsRWyvBpluSIAiHrbmvOxG19o5  
ZYFLA/Js5zpsPFs+H+yE7CajaLU0C5ifwx9S9GyxlrU/ooDVYqHd5Q==  
=Ksu6  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![mrpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac91a4/32.png) [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Post date:** [October 11, 2007, 4:56pm UTC](https://www.ruby-forum.com/t/betfair-soap-problem/116860/4 "2007-10-11T16:56:39Z")

</div>

Thankyou very very much - that works! Just for completeness I just  
mentioned the commands I used to enable the gem soap4r module to work as  
opposed to the built in earlier version version and also how to log in  
and obtain the active markets

irb(main):001:0\> require ‘rubygems’  
=\> false  
irb(main):002:0\> gem “soap4r”  
=\> true  
irb(main):003:0\> require “soap/wsdlDriver”  
=\> true  
irb(main):004:0\> wsdl = “BFGlobalService.wsdl”  
=\> “BFGlobalService.wsdl”  
irb(main):005:0\> drv =  
SOAP::WSDLDriverFactory.new(wsdl).create\_rpc\_driver  
=\>  
#\<SOAP::RPC::Driver:#SOAP::RPC::Proxy:https://api.betfair.com/global/v3/BFGlobalService\>  
logindetails={:locationId=\>0,:password=\>‘bfpasswd’,:username=\>‘bfuser’,:productId=\>82,:vendorSoftwareId=\>0,:ipAddress=“82.69.38.122”}  
=\> {:locationId=\>0, :username=\>“bfuser”, :productId=\>82,  
:vendorSoftwareId=\>0, :ipAddress=\>“82.69.38.122”, :password=\>“bfpasswd”}  
irb(main):008:0\> response= drv.login(:request=\>logindetails)  
=\> #\<SOAP::Mapping::Object:0x…fdbdec00a  
{[http://www.betfair.com/publicapi/v3/BFGlobalService/](http://www.betfair.com/publicapi/v3/BFGlobalService/)}Result=#\<SOAP::Mapping::Object:0x…fdbdeb8da  
{}header=#\<SOAP::Mapping::Object:0x…fdbdeb56a {}errorCode=“OK”  
{}minorErrorCode=“”  
{}sessionToken=“r3k89g9Lu+tWRHlenQg7YwraNx/+Din5VPCXsn3r8=”  
{}timestamp=“2007-10-11T14:42:14.600Z”\> {}currency=“GBP”  
{}errorCode=“OK” {}minorErrorCode=“”  
{}validUntil=“0001-01-01T00:00:00.000Z”\>\>  
irb(main):009:0\> apiRequestHeader={:clientStamp =\> 0,:sessionToken  
=\>response.result.header.sessionToken}  
=\> {:clientStamp=\>0,  
:sessionToken=\>“r3k89g9Lu+tWRHlenQg7YwraNx/+Din5VPCXsn3r8=”}  
irb(main):010:0\>  
response=drv.getActiveEventTypes(:request=\>{:header=\>apiRequestHeader})  
=\> #\<SOAP::Mapping::Object:0x…fdbd7e1e0  
{[http://www.betfair.com/publicapi/v3/BFGlobalService/](http://www.betfair.com/publicapi/v3/BFGlobalService/)}Result=#\<SOAP::Mapping::Object:0x…fdbd7e154  
{}header=#\<SOAP::Mapping::Object:0x…fdbd7e0b4 {}errorCode=“OK”  
{}minorErrorCode=“”  
{}sessionToken=“TXr3k89g9Lu+tWRHlenQg7YwraNx/+Din5VPCXsn3r8=”  
{}timestamp=“2007-10-11T14:43:44.088Z”\>  
{}eventTypeItems=#\<SOAP::Mapping::Object:0x…fdbd7811e  
{[http://www.betfair.com/publicapi/types/global/v3/](http://www.betfair.com/publicapi/types/global/v3/)}EventType=[#\<SOAP::Mapping::Object:0x…fdbd7809c  
{}id=“6423” {}name=“American Football” {}nextMarketId=“0”  
{}exchangeId=“0”\>, #\<SOAP::Mapping::Object:0x…fdbd71ad0 {}id=“61420”  
{}name=“Australian Rules” {}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd71184 {}id=“7511” {}name=“Baseball”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd6dbba {}id=“7522” {}name=“Basketball”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd69182 {}id=“6” {}name=“Boxing”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd663e2 {}id=“982477” {}name=“Bridge”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd645e2 {}id=“4968929” {}name=“Combat  
Sports” {}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd6189c {}id=“4” {}name=“Cricket”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd5c3ba {}id=“11” {}name=“Cycling”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd58210 {}id=“3503” {}name=“Darts”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd55100 {}id=“6231” {}name=“Financial  
Bets” {}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd52b44 {}id=“2152880” {}name=“Gaelic  
Games” {}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd4d2f2 {}id=“3” {}name=“Golf”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd463da {}id=“4339” {}name=“Greyhound  
Racing” {}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd3d5be {}id=“15” {}name=“Greyhound -  
Todays Card” {}nextMarketId=“20629641” {}exchangeId=“1”\>,  
#\<SOAP::Mapping::Object:0x…fdbd38b68 {}id=“468328” {}name=“Handball”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd34eb4 {}id=“7” {}name=“Horse Racing”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd2fa22 {}id=“13” {}name=“Horse Racing -  
Todays Card” {}nextMarketId=“20628919” {}exchangeId=“1”\>,  
#\<SOAP::Mapping::Object:0x…fdbd2b1d4 {}id=“7524” {}name=“Ice Hockey”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd26544 {}id=“8” {}name=“Motor Sport”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd2108a {}id=“5412697” {}name=“Pelota”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd1c904 {}id=“315220” {}name=“P0ker”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd18228 {}id=“2378961” {}name=“Politics”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd12436 {}id=“1477” {}name=“Rugby League”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd0bb36 {}id=“5” {}name=“Rugby Union”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd0633e {}id=“6422” {}name=“Snooker”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbd017b2 {}id=“1” {}name=“Soccer”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbcfec1a {}id=“14” {}name=“Soccer -  
Fixtures” {}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbcfab10 {}id=“10” {}name=“Special Bets”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbcf4f30 {}id=“2” {}name=“Tennis”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbcf053e {}id=“998917” {}name=“Volleyball”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbcec7fe {}id=“2901849” {}name=“Water Polo”  
{}nextMarketId=“0” {}exchangeId=“0”\>,  
#\<SOAP::Mapping::Object:0x…fdbce701a {}id=“451485” {}name=“Winter  
Sports” {}nextMarketId=“0” {}exchangeId=“0”\>]\> {}minorErrorCode=“”  
{}errorCode=“OK”\>\>  
irb(main):011:0\>

---

<div class="post-metadata">

**Author:** ![mrpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac91a4/32.png) [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Post date:** [October 11, 2007, 5:09pm UTC](https://www.ruby-forum.com/t/betfair-soap-problem/116860/5 "2007-10-11T17:09:09Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

Peter Aszkenasy wrote:

> Thankyou very very much - that works!

Good.

Can you confirm that the local WSDL editing is needed or not? I’ll  
contact to the server administrator if the WSDL is wrong.

Regards,  
// NaHi  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRw48PR9L2jg5EEGlAQL6PQf9Ed+eb+yuV9+WU5oYtW6NwGXaM7IyzNFR  
w+GsT9zBv6YW0/Js8IZwKGD/0gfaPJj5bGDugBf3/yBktHs1A+0WyVThOKOJocnL  
SkuDHzwAW68pB5o49rUI9bgSnDrV/Df+fTNmPMgDdkyNNs0Ks1IDLOaOFQWRpEAj  
6zTt2Qs5iyKhJTJqhFh6AamVgMgvQ8+AVJtbCm8W6ngp7FHfFtoa1PiAn4A5xdlY  
kjbx5CX2/2hT6YF2wK7o8EMg4VJZK2Gqhl+rtY7LGxTP0ILLx1eWpwm46+owvc6e  
+UiXBn00bwhQPYw3oOyY09BR3et1EOSCnpLzNbtzr8MenTK4/vyusw==  
=kEGy  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![mrpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac91a4/32.png) [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Post date:** [October 11, 2007, 4:27pm UTC](https://www.ruby-forum.com/t/betfair-soap-problem/116860/6 "2007-10-11T16:27:59Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

Peter Aszkenasy wrote:

> Please see irb output below:-
> 
> irb(main):010:0\> wsdl\_url=“BFGlobalService.wsdl”=\>  
> “BFGlobalService.wsdl”  
> irb(main):011:0\> soap = SOAP::WSDLDriverFactory.new( wsdl\_url  
> ).create\_rpc\_driverignored attr: {}abstract  
> ignored attr: {}nillable  
> ignored attr: {}mixed

Oops. I should have known it before. You are using bundled version of  
soap4r with ruby 1.8.X, right? Please install latest soap4r stable  
release from [http://dev.ctor.org/soap4r/#Download](http://dev.ctor.org/soap4r/#Download)

Here’s my sample client (BFGlobalService.wsdl is edited locally):

require ‘soap/wsdlDriver’  
wsdl = ‘BFGlobalService.wsdl’  
drv = SOAP::WSDLDriverFactory.new(wsdl).create\_rpc\_driver  
drv.wiredump\_dev = STDOUT

# no connection and causes EmptyResponseError

drv.test\_loopback\_response \<\< ‘’  
header = { :clientStamp =\> 0, :sessionToken =\> “token” }  
p drv.getAllEventTypes(  
:request =\> {  
:header =\> {  
:clientStamp =\> 0,  
:sessionToken =\> “token”  
},  
:locate =\> ‘en’  
}  
)

And the generated request under soap4r-1.5.8:

\<?xml version="1.0" encoding="utf-8" ?\>

\<env:Envelope xmlns:xsd=“[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)”  
xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”  
xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>  
env:Body  
\<n1:getAllEventTypes  
xmlns:n1=“[http://www.betfair.com/publicapi/v3/BFGlobalService/](http://www.betfair.com/publicapi/v3/BFGlobalService/)”\>  
\<n1:request  
xmlns:n2=“[http://www.betfair.com/publicapi/types/global/v3/](http://www.betfair.com/publicapi/types/global/v3/)”\>  
n2:header  
n2:clientStamp0\</n2:clientStamp\>  
n2:sessionTokentoken\</n2:sessionToken\>  
\</n2:header\>  
\<n2:locale xsi:nil=“true”\>\</n2:locale\>  
\</n1:request\>  
\</n1:getAllEventTypes\>  
\</env:Body\>  
\</env:Envelope\>

When it still does not work, please get a wiredump with  
drv.wiredump\_dev = STDOUT  
and show me the wiredump.

Regards,  
// NaHi

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRw4ymh9L2jg5EEGlAQIJ6gf+JB/VwAvXzR0KZQMmv8PVcJ7GYgCqE09s  
1IwMUbrO3zgri7xVaQIlMumTMq9ofWZrvx940v6G8h8tUguiKRX6iHYvOB3GxWOi  
kt6YgqcK1BLbt0mWkH5+JbatapeIxW+jE/94fdhiBIURbmTJbYmQdUQhTu3i43VH  
nH6/PGlXKdqpknXMHwMMqAH47zpLoWFEnwTwU+fT1YlF8ZkVPtImwVjNA/jOaHj/  
M641pxmkRYnFVlmEHMKiHKmFGohJtwY+ceaJTqx0NK5clvE1kxdqPkoYT6C6lPPs  
ITCm4blknOxjDDfSA8I5ZKn6+mbYZqd/OezDlu0mmEPlOaZwBpcaRA==  
=4AVG  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![mrpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac91a4/32.png) [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Post date:** [March 24, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/betfair-soap-problem/116860/7 "2008-03-24T17:24:28Z")

</div>

I installed soap4r as a gem as specified on that soap4r page, and now  
when I start my site I get. When I installed soap4r, I DID include  
dependencies:

blake-millers-power-mac-g5:trunk bmiller$ script/server  
./script/…/config/boot.rb:29:Warning: require\_gem is obsolete. Use gem  
instead.  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active\_support/dependencies.rb:478:in  
`const_missing': uninitialized constant XSD::NS::KNOWN_TAG (NameError) from /usr/local/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/ns.rb:18 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`gem\_original\_require’  
from  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:in`require’  
from  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active\_support/dependencies.rb:343:in  
`new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:in`require’  
from  
/usr/local/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/generator.rb:10  
from  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require' ... 47 levels... from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:61:in`require\_gem’  
from ./script/…/config/boot.rb:29  
from script/server:2:in `require’  
from script/server:2

---

<div class="post-metadata">

**Author:** ![mrpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac91a4/32.png) [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Post date:** [October 11, 2007, 5:13pm UTC](https://www.ruby-forum.com/t/betfair-soap-problem/116860/8 "2007-10-11T17:13:49Z")

</div>

Yes - once I downloaded and edited the wsdl file locally as per your  
instructions, everything is now working. Using the remote service  
(soap4r 1.5.8) without downloading the wsdl file results in the  
following error:-

irb(main):001:0\> require ‘rubygems’  
=\> false  
irb(main):002:0\> gem “soap4r”  
=\> true  
irb(main):003:0\> require “soap/wsdlDriver”  
=\> true  
irb(main):004:0\> wsdl =  
“[https://api.betfair.com/global/v3/BFGlobalService](https://api.betfair.com/global/v3/BFGlobalService)”  
=\> “[https://api.betfair.com/global/v3/BFGlobalService](https://api.betfair.com/global/v3/BFGlobalService)”  
irb(main):005:0\> bfsoapclient = SOAP::WSDLDriverFactory.new(  
wsdl).create\_rpc\_driver  
RuntimeError: Unexpected response: #\<HTTP::Message::Headers:0xb7a1abf0  
@response\_status\_code=404, @chunked=false, @body\_charset=nil,  
@request\_uri=nil, @header\_item=[[“Server”, “Apache-Coyote/1.1”],  
[“X-Powered-By”, “Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch\_4\_0  
date=200610162339)/Tomcat-5.5”], [“Server”, “TME-GLUE/5.0.2”], [“Date”,  
“Thu, 11 Oct 2007 15:12:23 GMT”], [“Content-Type”,  
“text/html;charset=ISO-8859-1”], [“Content-Length”, “1510”]],  
@body\_type=nil, @request\_method=nil, @body\_date=nil,  
@request\_via\_proxy=nil, @is\_request=false, @reason\_phrase=“cannot find  
/var/sportex/betex/as/jboss-4.0.5.GA/server/betex/./tmp/deploy/tmp64997japi-public-ws-global-application-8.4.2-8.ear-contents/api-public-ws-global-5.0-exp.war/BFGlobalService”,  
@body\_size=0, @request\_query=nil, @http\_version=“1.1”\>  
from  
/usr/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient.rb:2058:in  
`follow_redirect' from /usr/lib/ruby/gems/1.8/gems/httpclient-2.1.2/lib/httpclient.rb:1890:in `get\_content’  
from  
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:73:in  
`fetch' from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/wsdl/xmlSchema/importer.rb:36:in `import’  
from  
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/wsdl/importer.rb:18:in  
`import' from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb:146:in `import’  
from  
/usr/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb:32:in  
`initialize' from (irb):5:in `new’  
from (irb):5

---

<div class="post-metadata">

**Author:** ![mrpete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac91a4/32.png) [@mrpete](https://www.ruby-forum.com/u/mrpete)\
**Post date:** [March 24, 2008, 6:16pm UTC](https://www.ruby-forum.com/t/betfair-soap-problem/116860/9 "2008-03-24T18:16:51Z")

</div>

I fixed it. I didn’t have the gem declaration:  
require ‘rubygems’  
gem ‘soap4r’

At the top of environment.rb

Blake M. wrote:

> I installed soap4r as a gem as specified on that soap4r page, and now  
> when I start my site I get. When I installed soap4r, I DID include  
> dependencies:
> 
> blake-millers-power-mac-g5:trunk bmiller$ script/server  
> ./script/…/config/boot.rb:29:Warning: require\_gem is obsolete. Use gem  
> instead.  
> /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active\_support/dependencies.rb:478:in  
> `const_missing': uninitialized constant XSD::NS::KNOWN_TAG (NameError) from /usr/local/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/ns.rb:18 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`gem\_original\_require’  
> from  
> /usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
> `require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:in`require’  
> from  
> /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active\_support/dependencies.rb:343:in  
> `new_constants_in' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:in`require’  
> from  
> /usr/local/lib/ruby/gems/1.8/gems/soap4r-1.5.8/lib/soap/generator.rb:10  
> from  
> /usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
> `gem_original_require' ... 47 levels... from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:61:in`require\_gem’  
> from ./script/…/config/boot.rb:29  
> from script/server:2:in `require’  
> from script/server:2
