View Single Post
Old 12-05-2008, 16:26   #5 (permalink)
Trilobite
Legendary Punter
 
Trilobite's Avatar
 
Join Date: 17 Oct 2006
Posts: 1,560
Awards Showcase
Daily Horse Racing Competition Daily Horse Racing Competition 
Total Awards: 2
Default Re: Betfair Free API

Well ive managed to get a OK reply from a login routine i found and modified (on the BDP forum).

But this SOAP/XML stuff might as well be Chinese to me right now


Ive got the API4.0_xml_samples.zip from which i am trying to make my Envelope from, and ive got the API reference guide.




But i cant get a reply to the first function iam trying to make :

getBetHistory

return =

HTML Code:
<?xml version='1.0' ?> <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <env:Body> <env:Fault> <faultcode>General</faultcode> <faultstring>Internal Error</faultstring> </env:Fault> </env:Body> </env:Envelope>
from my first attempt of:

HTML Code:
Private Sub get_bet_history_Click()
Dim sEnvelope As String, sReply As String


' create the SOAP Envelope   STRsessionToken = original_key from login
'QUOTE_MARK= """"


sEnvelope = sBody _
& "<m:getBetHistory xmlns:m=" & QUOTE_MARK & "http://www.betfair.com/publicapi/BFService/" & QUOTE_MARK & ">" _
& "<m:request>" & "<clientStamp>0</clientStamp>" _
& "<sessionToken>" & STRsessionToken & "</sessionToken>" _
& "<betTypesIncluded>M</betTypesIncluded>" _
& "<detailed>1</detailed>" _
& "<eventTypeIds><m0:int>0</m0:int></eventTypeIds>" _
& "<m0:int></m0:int>" _
& "<marketTypesIncluded><m0:MarketTypeEnum>O</m0:MarketTypeEnum></marketTypesIncluded>" _
& "<placedDateFrom>2008-01-01T09:30:47-05:00</placedDateFrom>" _
& "<placedDateTo>2008-05-01T09:30:47-05:00</placedDateTo>" _
& "recordCount>100</recordCount>" _
& "<sortBetsBy>NONE</sortBetsBy>" _
& "<startRecord>0</startRecord>" _
& "</m:request></m:getBetHistory></SOAP-ENV:Body></SOAP-ENV:Envelope>"

sReply = MakeSOAPRequest(sEnvelope, "getBetHistory")


txt_return.Text = sReply

HTML Code:
Private Function MakeSOAPRequest(ByVal sReq As String, ByVal sMethod As String) As String
' returns the response xml

' send message to server
oHTTP.open "POST", "https://api.betfair.com/betex-api-public-ws/BFService", False

' set standard SOAP/XML header for the content-type
oHTTP.setRequestHeader "Content-Length", CStr(Len(sReq))
oHTTP.setRequestHeader "Content-Type", "text/xml"
oHTTP.setRequestHeader "SOAPAction", sMethod

' make the SOAP call
oHTTP.send sReq

' get the response xml
MakeSOAPRequest = oHTTP.responseText

End Function




This is day 1 that my eyes have ever seen any Betfair API + SOAP + XML so be gentle with me

Last edited by Trilobite; 12-05-2008 at 16:29.
Trilobite is offline   Reply With Quote