Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to connect to Betfair API
Message
From
03/03/2008 05:21:11
 
 
General information
Forum:
Visual FoxPro
Category:
Web Services
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01298019
Message ID:
01298102
Views:
26
Out of interest I did try to find if Betfair had a test username but couldn't find anything.

I may have a play with it later.




>Hi,
>
>>Same error as Doug.
>
>Now I'm confused. Doug's error was:
>
Client:Incorrect number of parameters supplied for SOAP request HRESULT=0x80070057: The parameter is incorrect
>
>>If you pass any other string (eg "testusername") you get back an invalid username/password message.
>
>Ah OK. I see that. So there's no way to work out (without using a known valid login) whether the LoginErrorEnum 'INVALID_USERNAME_OR_PASSWORD' is an accurate return (i.e. supplied info was truly invalid) or being returned for some other reason. Poor implementation!
>
>I took a quick look at the XSD and the XML being sent does seem to comply with the LoginReq sequence though.
>
>Update: Tried the login via .NET - the generated classes matched the elements and datatypes Doug was using. And a .NET call to the service received the same 'INVALID_USERNAME_OR_PASSWORD' response.
>
>Not possible to learn more without valid credentials for testing.....
>
>Regards,
>Viv
>
>
>>>>I just ran it in 9 and got an error.
>>>Same error as Doug? Can you try in 8?
>>>
>>>>Its a problem with whats in lclogin.
>>>Don't see how that can be the case since it worked for me.
>>>Regards,
>>>Viv
>>>>
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>Haven't got VFP9.0 to hand so can't check. Do you have 8? Of course it could be something else in the environment.
>>>>>
>>>>>BTW I think you could drop the and tags - it should work either way.
>>>>>Regards,
>>>>>Viv
>>>>>
>>>>>>It's actually the "lcXML = loBFGlobalService.login(lcLogin)" line that is causing the error...
>>>>>>
>>>>>>Client:Incorrect number of parameters supplied for SOAP request HRESULT=0x80070057: The parameter is incorrect.
>>>>>>
>>>>>>If you aren't getting this error at the login command then maybe it is something with the _ws3client.vcx in VFP9.
>>>>>>
>>>>>>Regards
>>>>>>Doug
>>>>>>
>>>>>>
>>>>>>>>Hi,
>>>>>>>>
>>>>>>>>I am trying to connect to the Betfair web service API with the following code...
>>>>>>>>
>>>>>>>>
>>>>>>>>LOCAL loBFGlobalService AS "XML Web Service"
>>>>>>>>* LOCAL loBFGlobalService AS "MSSOAP.SoapClient30"
>>>>>>>>* Do not remove or alter following line. It is used to support IntelliSense for your XML Web service.
>>>>>>>>*__VFPWSDef__: loBFGlobalService = https://api.betfair.com/global/v3/BFGlobalService.wsdl , BFGlobalService , BFGlobalService
>>>>>>>>LOCAL loException, lcErrorMsg, loWSHandler
>>>>>>>>TRY
>>>>>>>>	loWSHandler = NEWOBJECT("WSHandler",IIF(VERSION(2)=0,"",HOME()+"FFC\")+"_ws3client.vcx")
>>>>>>>>	loBFGlobalService = loWSHandler.SetupClient("https://api.betfair.com/global/v3/BFGlobalService.wsdl", "BFGlobalService", "BFGlobalService")
>>>>>>>>	* Call your XML Web service here.  ex: leResult = loBFGlobalService.SomeMethod()
>>>>>>>>	*login(request AS LoginReq) AS LoginResp
>>>>>>>>		
>>>>>>>>CATCH TO loException
>>>>>>>>	lcErrorMsg="Error: "+TRANSFORM(loException.Errorno)+" - "+loException.Message
>>>>>>>>	DO CASE
>>>>>>>>	CASE VARTYPE(loBFGlobalService)#"O"
>>>>>>>>		* Handle SOAP error connecting to web service
>>>>>>>>	CASE !EMPTY(loBFGlobalService.FaultCode)
>>>>>>>>		* Handle SOAP error calling method
>>>>>>>>		lcErrorMsg=lcErrorMsg+CHR(13)+loBFGlobalService.Detail
>>>>>>>>	OTHERWISE
>>>>>>>>		* Handle other error
>>>>>>>>	ENDCASE
>>>>>>>>	* Use for debugging purposes
>>>>>>>>	MESSAGEBOX(lcErrorMsg)
>>>>>>>>FINALLY
>>>>>>>>ENDTRY
>>>>>>>>
>>>>>>>>SET TEXTMERGE ON
>>>>>>>>TEXT TO lcLogin NOSHOW PRETEXT 7
>>>>>>>><?xml version="1.0" encoding="utf-16"?>
>>>>>>>><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>>>>>>  <soap:Body>
>>>>>>>>    <login xmlns="http://www.betfair.com/publicapi/v3/BFGlobalService/">
>>>>>>>>      <request>
>>>>>>>>        <ipAddress xmlns="" />
>>>>>>>>        <locationId xmlns="">0</locationId>
>>>>>>>>        <password xmlns="">bfpassword</password>
>>>>>>>>        <productId xmlns="">82</productId>
>>>>>>>>        <username xmlns="">bfusername</username>
>>>>>>>>        <vendorSoftwareId xmlns="">0</vendorSoftwareId>
>>>>>>>>      </request>
>>>>>>>>    </login>
>>>>>>>>  </soap:Body>
>>>>>>>></soap:Envelope>
>>>>>>>>ENDTEXT
>>>>>>>>SET TEXTMERGE OFF
>>>>>>>>
>>>>>>>>TRY
>>>>>>>>        *loBFGlobalService .ConnectorProperty("Timeout") = 240000
>>>>>>>>        lcXML = loBFGlobalService.login(lcLogin)
>>>>>>>>        xmltocursor(lcXML)
>>>>>>>>        BROWSE
>>>>>>>>CATCH TO loException
>>>>>>>>	lcErrorMsg="Error: "+TRANSFORM(loException.Errorno)+" - "+loException.Message
>>>>>>>>	DO CASE
>>>>>>>>	CASE VARTYPE(loBFGlobalService)#"O"
>>>>>>>>		* Handle SOAP error connecting to web service
>>>>>>>>	CASE !EMPTY(loBFGlobalService.FaultCode)
>>>>>>>>		* Handle SOAP error calling method
>>>>>>>>		lcErrorMsg=lcErrorMsg+CHR(13)+loBFGlobalService.Detail
>>>>>>>>	OTHERWISE
>>>>>>>>		* Handle other error
>>>>>>>>	ENDCASE
>>>>>>>>	* Use for debugging purposes
>>>>>>>>	MESSAGEBOX(lcErrorMsg)
>>>>>>>>FINALLY
>>>>>>>>ENDTRY
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>...however the "lcXML = loBFGlobalService.login(lcLogin)" returns the following object...
>>>>>>>>error -
>>>>>>>>
>>>>>>>>Client:Incorrect number of parameters supplied for SOAP request HRESULT=0x80070057: The parameter is incorrect.
>>>>>>>>
>>>>>>>>The above XML was generated by a utility available on the Betfair site, but they also have some downloadable XML files which are slightly different...
>>>>>>>>
>>>>>>>>
>>>>>>>><?xml version="1.0" encoding="utf-8"?>
>>>>>>>><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>>>>>>  <soap:Body>
>>>>>>>>    <login xmlns="http://www.betfair.com/publicapi/v3/BFGlobalService/">
>>>>>>>>      <request>
>>>>>>>>      	<ipAddress xmlns=""></ipAddress>
>>>>>>>>        <locationId xmlns="">0</locationId>
>>>>>>>>        <password xmlns="">bfpassword</password>
>>>>>>>>        <productId xmlns="">82</productId>
>>>>>>>>        <username xmlns="">bfusername</username>
>>>>>>>>        <vendorSoftwareId xmlns="">0</vendorSoftwareId>
>>>>>>>>      </request>
>>>>>>>>    </login>
>>>>>>>>  </soap:Body>
>>>>>>>></soap:Envelope>
>>>>>>>>
>>>>>>>>
>>>>>>>>...both forms generate the sane error.
>>>>>>>>
>>>>>>>>Hoping someone can shed some light on this.
>>>>>>>
>>>>>>>Hi,
>>>>>>>Code as listed worked for me (i.e. got Invalid Login back) but XMLTOCURSOR() failed (probably because the response is not structured in a way that can be translated to a cursor)
>>>>>>>Using VFP8 - don't know if the WSCLIENT changed in 9.0?
>>>>>>>Regards,
>>>>>>>Viv
Previous
Reply
Map
View

Click here to load this message in the networking platform