[Gambas-user] Web Services: Working with WSDL

birchy pokerbirch at ...1601...
Fri Nov 7 02:30:13 CET 2008


I've done a little research into the Betfair soap thing and here are 2
important urls:
http://bdphelp.betfair.com/API6/6.0/RefGuide/wwhelp/wwhimpl/js/html/wwhelp.htm
Betfair API6 Documentation 
https://api.betfair.com/global/v3/BFGlobalService.wsdl Betfair API6 Global
WSDL file 
Their documentation states that the Login() request XML should look like
this:

<?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>
        <locationId xmlns=''>?</locationId>
        <password xmlns=''>?</password>
        <productId xmlns=''>?</productId>
        <username xmlns=''>?</username>
        <vendorSoftwareId xmlns=''>?</vendorSoftwareId>
      </request>
    </login>
  </soap:Body>
</soap:Envelope>

The 5 ?'s are user defined values. I don't know how, but we should be able
to produce the above XML from the WSDL file?? The WSDL file details the
entire protocol, so no other information should be required. Perhaps this
can be parsed with libxml or gb.xml?

All XML requests should be sent to the server via http, so any "auto" code
generation would produce:
1) A standard http function for sending/receiving (curl HttpClient??)
2) A single function for each service call. This would be a simple wrapper
for the XML string, something like:

PUBLIC FUNCTION Login(locationId AS String,
					  password AS String,
					  productId AS String,
					  username AS String,
					  vendorSoftwareId AS String) AS String
   DIM s[2] AS String
   
   ' build the XML request string
   s[0] = "<?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>" &
   		  "<locationId xmlns=''>" & locationId & "</locationId>" &
   		  "<password xmlns=''>" & password & "</password>" &
   		  "<productId xmlns=''>" & productId & "</productId>" &
   		  "<username xmlns=''>" & username & "</username>" &
   		  "<vendorSoftwareId xmlns=''>" & vendorSoftwareId &
"</vendorSoftwareId>" &
   		  "</request>" &
   		  "</login>" &
   		  "</soap:Body>" &
   		  "</soap:Envelope>"
   ' set the url
   s[1] = "http://www.betfair.com/publicapi/v3/BFGlobalService/"
   ' send the request
   ' TO DO: pass XML to http function...
END

-- 
View this message in context: http://www.nabble.com/Web-Services%3A-Working-with-WSDL-tp20328779p20373153.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list