On 1/12/07, Casey McGuire wrote:
> Garry Bettle wrote:
> > Howdy all,
> >
> > I'm trying to use an API from BetFair.com and I thought the S in SOAP
> > stood for Simple...?
> >
> > The WSDL file is:
> >
> > https://api.betfair.com/global/v3/BFGlobalService.wsdl
> >
> > I even downloaded Rick's wwSOAP and it doesn't work either (NB:  I'm
> > by no means dissing Rick - it's probably badly formed XML somewhere or
> > PEBCAK).
> >
> > Any headsup or tips?  Or, should I just go to the pub, its' Friday.
> >
> > Not a happy bunny,
>
> Can you be a little more specific on your problem.  Are you having
> trouble getting SOAP to connect to the server or is it a particular
> function call to the server that is causing you troubles?
>
> Casey

Hi Casey,

Oh, I don't know anymore - and I haven't even been to the pub yet.

No matter how I format the XML that is sent to the Login method
exposed by the WSDL, it craps out with:

OK2007-01-12T16:14:35.741ZINVALID_USERNAME_OR_PASSWORD0001-01-01T00:00:00.000Z

And the XML WORKS in an .NET WSDL testing suite I downloaded.   From
the Request/Response tab of this app, I've copied the XML used when I
use the Login method - see below - I've replaced the UserName &
Password with *s, but I've stored and use only the original:

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

Here's the code I'm using:

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 as Exception, lcErrorMsg, loWSHandler, lcLogin,
loLoginResp as Custom, lcLogout

SET TEXTMERGE ON
TEXT TO lcLogout 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>
    <logout xmlns="http://www.betfair.com/publicapi/BFServiceV2/";>
      <request>
        <header xmlns="">
          <clientStamp>0</clientStamp>
          <sessionToken>XXXXXXXXX</sessionToken>
        </header>
      </request>
    </logout>
  </soap:Body>
</soap:Envelope>
ENDTEXT
SET TEXTMERGE OFF

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])

        lcCurrency = []
        lcErrorCode = []
        lcMinorErrorCode = []
        lcValidUntil = []
        lcPWORD = FILETOSTR( LOCFILE( [Login.txt]))
        
        loLoginResp = loBFGlobalService.Login( lcPWORD)
        IF ![INVALID_USERNAME_OR_PASSWORD] $ loLoginResp.Context.Text
                = MESSAGEBOX( [Login successfull], 48, [Yes!!!])
                loBFGlobalService.Logout( lclogout)
                = MESSAGEBOX( [Logout successfull], 48, [Yes!!!])
        ELSE
                = MESSAGEBOX( [Login failed], 48, [Feck!!!])
        ENDIF

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

<rant>
If I ever meet the f**kwit who designed SOAP ...

At this rate - 2 days so far - I could have wrote the whole bloody
project in PHP!
</rant>

G.


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to