500 Internal Server Error on login SOAP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • morto
    Junior Member
    • Aug 2011
    • 7

    #1

    500 Internal Server Error on login SOAP

    Hi,

    I'm getting a 500 Internal Server Error response when connecting.

    Is this because I might need an active betfair account?

    I have deposits $15 in my betfair account (Australian) so I believe that is considered to be now an active account?

    Or should it be betfair UK? (It says this here --> http://bdp.betfair.com/index.php?opt...d=55&Itemid=68

    For a Betfair account to be considered 'active', there needs to be at least one transaction (settled bet, deposit, withdrawal) displayed on the UK Account Statement at 'My Account' (within the last three months).

    Or is the 500 error something else? My SOAP code works fine on other services.

    Chris
  • MarkL
    Junior Member
    • Oct 2008
    • 29

    #2
    You do need an item on the UK account statement to log in. However you should be getting a loginResp with the error PRODUCT_REQUIRES_A_FUNDED_ACCOUNT, not an HTTP 500 error.

    Comment

    • morto
      Junior Member
      • Aug 2011
      • 7

      #3
      Hi MarkL,

      Oki. Is there anything else I'm missing? im still getting the 500 error.

      I tried using https://api-au.betfair.com/exchange/...geService.wsdl and get a different error "operation login not present in WSDL."

      Any ideas?

      Comment

      • morto
        Junior Member
        • Aug 2011
        • 7

        #4
        Im using php: Here is the code:

        <?php

        include dirname(realpath(__FILE__)).'/../lib/nusoap.php';

        $betfair_login = 'xxxxxx';
        $betfair_password = 'xxxxxx';

        $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
        $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
        $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
        $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
        $client = new nusoap_client('https://api-au.betfair.com/exchange/v5/BFExchangeService.wsdl', true,
        $proxyhost, $proxyport, $proxyusername, $proxypassword);

        $err = $client->getError();
        if ($err) {
        // Display the error
        echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
        // At this point, you know the call that follows will fail
        }
        // Doc/lit parameters get wrapped

        $param = array('username' => $betfair_login,'password' => $betfair_password,'productId' => '82','vendorSoftwareId' => '0','locationId' => '0','ipAddress' => '0');
        $result = $client->call('login', array('parameters' => $param), '', '', false, true);

        // Check for a fault
        if ($client->fault) {
        echo '<h2>Fault</h2><pre>';
        print_r($result);
        echo '</pre>';
        } else {
        // Check for errors
        $err = $client->getError();
        if ($err) {
        // Display the error
        echo '<h2>Error</h2><pre>' . $err . '</pre>';
        } else {

        echo '<pre>';
        print_r($result);
        echo '</pre>';
        }


        }

        ?>
        IS this something incorrect in my code? This code works fine on other services.

        Comment

        • smilerdude
          Junior Member
          • Jun 2010
          • 11

          #5
          Have you done a Global login first ?

          I've not dealt with the Australian exchanges, but my understanding of the login process is that you need to login via the GLOBAL wsdl first to acquire a session token and then point your operations against the relevant exchange wsdl.

          From the code you've posted, you're attempting to login directly against the AUS exchange first, rather than the GLOBAL.

          I may be wrong and would happily be corrected by someone else.

          Comment

          • morto
            Junior Member
            • Aug 2011
            • 7

            #6
            When I try and connect to the GLOBAL WSDL I get a 500 Internal Server error.

            Im stumped as to what is the problem.

            Comment

            • smilerdude
              Junior Member
              • Jun 2010
              • 11

              #7
              Have you tried using the Betfair supplied PHP Framework demo source code to log on ?

              I would compare the SOAP request and the XML that is generated between the Betfair Demo API and the NuSOAP library.

              Is it possible that there maybe a config issue with the NuSOAP library that's causing the SOAP request to be out of kilter without what Betfair's servers are expecting ?

              I've never used NuSOAP and I use the Betfair's demo API framework to fit my scripting needs.

              Comment

              • morto
                Junior Member
                • Aug 2011
                • 7

                #8
                Hi smilerdude,

                Thanks for the reply.

                I will that a go. Do you have a link to where I can view the Betfair Framework?

                Cheers,

                Chris

                Comment

                • morto
                  Junior Member
                  • Aug 2011
                  • 7

                  #9
                  Oki I found the framework code. I ran the example with my login details and got

                  Header Error Enum: OK
                  Login (Global API) X-ip -> No Error Enum: LOGIN_RESTRICTED_LOCATION

                  My Au Betfair acc is funded though...

                  Comment

                  • morto
                    Junior Member
                    • Aug 2011
                    • 7

                    #10
                    I think the source of the problem is my webhosting is in the US which Betfair blocks.

                    Comment

                    • smilerdude
                      Junior Member
                      • Jun 2010
                      • 11

                      #11
                      That's the reason.

                      There are a number of countries that Betfair blocks the IP address due to Gambling laws of those countries.

                      USA and France are 2 that spring to mind.

                      If you've already got a funded account, you can try hosting your scripts at a web hosting site outside the USA jurisdiction.

                      This has the advantage getting around the country IP blocking, and it gives you faster and reliable connections to the Betfair Servers.

                      Comment

                      • nicnolte
                        Junior Member
                        • Feb 2013
                        • 3

                        #12
                        Http 500

                        I have HTTP 500 too, my server is in Malta,
                        however when I am looking the panel security in my betfair account, I have a login successful
                        <?php

                        $username = 'xxx';
                        $password = 'yyy';
                        $productid = 82;
                        $locationId = 0;
                        $vendorSoftwareId = 0;
                        $ipAddress = '9999999';

                        $client = new SoapClient("https://api.betfair.com/global/v3/BFGlobalService.wsdl");

                        try {

                        $result = $client->login(array('request'=>array('username'=>$usernam e, 'password'=>$password, 'productId'=>$productid, 'locationId'=>$locationId, 'vendorSoftwareId'=>$vendorSoftwareId, 'ipAddress'=>$ipAddress)));
                        echo $result;
                        } catch (SoapFault $fault) {

                        die("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})");
                        }

                        ?>

                        Comment

                        • Fred77
                          Junior Member
                          • Jan 2009
                          • 37

                          #13
                          nicnolte, put this at the top of your script then you should see where the error is.

                          PHP Code:
                          ini_set('display_errors'1); // we're not in public so show errors
                          error_reporting(E_ALL); // lets see all error types to avoid sloppy programming 

                          Comment

                          • nicnolte
                            Junior Member
                            • Feb 2013
                            • 3

                            #14
                            Originally posted by Fred77 View Post
                            nicnolte, put this at the top of your script then you should see where the error is.

                            PHP Code:
                            ini_set('display_errors'1); // we're not in public so show errors
                            error_reporting(E_ALL); // lets see all error types to avoid sloppy programming 
                            Oh great ! You're right.
                            It was nothing : just problem with the "echo".

                            thx

                            Catchable fatal error: Object of class stdClass could not be converted to string in /var/www/..../.PHP on line 16

                            Comment

                            Working...
                            X