Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to connect to Betfair API
Message
De
02/03/2008 04:41:02
 
 
À
02/03/2008 00:17:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01298019
Message ID:
01298026
Vues:
13
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform