Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Scoreloop

Reply
Contributor
jrjackso
Posts: 20
Registered: ‎07-01-2011
My Device: BlackBerry PlayBook
Accepted Solution

Scoreloop SDK - SC_HTTP_SERVER_ERROR

Hi,

 

I have more than 1 PlayBook and am using the Scoreloop SDK.  On one of my devices, I keep getting SC_HTTP_SERVER_ERROR returned. The other works fine.  Any ideas?

 

I've compared Wi-Fi settings, tried with/without bluetooth, api.scoreloop.com resolves to the same IP on both devices, rebooted the device that doesn't work, it's the exact same .BAR file, etc.  For all practical purposes, to me everything looks to be identical.

 

Thanks,

-Jason

 

(note: recently I upgraded the working one to 2.0.1.668, so technically it's a different OS version now :smileywink:.  However, it was working before with 2.0.1.358 as well)

Contributor
jrjackso
Posts: 20
Registered: ‎07-01-2011
My Device: BlackBerry PlayBook

Re: Scoreloop SDK - SC_HTTP_SERVER_ERROR

I thought of another difference: the PlayBook that works has my developer certificate installed on it. However, I'm deploying signed .BAR files. The app works on both - it's just the Scoreloop component that doesn't.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Scoreloop SDK - SC_HTTP_SERVER_ERROR

Try pinging the server in question (or any other) from both devices and see if there's any difference in connectivity or reliability of the connection.

When you say you "keep getting" that error, does that mean 100% of the time, or just frequently, or maybe even just infrequently?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Contributor
jrjackso
Posts: 20
Registered: ‎07-01-2011
My Device: BlackBerry PlayBook

Re: Scoreloop SDK - SC_HTTP_SERVER_ERROR

100% can connect fine from one and haven't been able to connect ever from the other. They have ping off (neither playbook gets replies). I've hit the https fine from the browser in both but can't get beyond a login so it's not the most comprehensive test. With WiFi off, I get the error instantly.. With it on, it takes a bit, then errors.  The code is "non-200 response from server" in the documentation but clearly it's working from the one device. Unfortunately my router sucks, so I can't sniff the traffic too easily.

Contributor
jrjackso
Posts: 20
Registered: ‎07-01-2011
My Device: BlackBerry PlayBook

Re: Scoreloop SDK - SC_HTTP_SERVER_ERROR

05/08/12 13:50:13.666: [0xfa0] HTTP: HTTP/1.1 422
05/08/12 13:50:13.667: [0xfa0] HTTP: Got headers
[C:/scoreloop/ansic/core/bayeux/sc_bayeux_connection.c:563] ERR: HTTP status received: 422
Contributor
jrjackso
Posts: 20
Registered: ‎07-01-2011
My Device: BlackBerry PlayBook

Re: Scoreloop SDK - SC_HTTP_SERVER_ERROR

So just to follow-up, Scoreloop is currently looking into this on their end. (In the meantime, I'm hoping not TOO many get hit by the problem)
New Contributor
stchhx
Posts: 4
Registered: ‎08-30-2012
My Device: BB10

Re: Scoreloop SDK - SC_HTTP_SERVER_ERROR

Hi Jason,

 

Is there any upate from Scoreloop? I am hitting the same error. My code run fine in simulator but get this error when deployed to Playbook. I have only one Playbook though, and I am using the Marmalade SDK.

 

Regards,

 

Sean

Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Scoreloop SDK - SC_HTTP_SERVER_ERROR

Can you share what exaclty you are requesting from ScoreLoop (which function) when you get this error?

New Contributor
stchhx
Posts: 4
Registered: ‎08-30-2012
My Device: BB10

Re: Scoreloop SDK - SC_HTTP_SERVER_ERROR

Since my main.cpp is not that big I paste the whole file here:

 

#include <algorithm>
#include <stdlib.h>
#include "s3e.h"
#include "Iw2D.h"
#include "IwGx.h"
#include "s3ePointer.h"
#include "sc_client.h"

#include "BasicBoard.h"
#include "UIBoard.h"
#include "UIInkButtons.h"
#include "Touch.h"

#define SC_TEST_GAME_ID         "b9b41ecc-8d98-4363-bfb3-c530e3452456"
#define SC_TEST_GAME_SECRET     "9RqaCfv3bAYhxyviEipsmxmOh3dbApWlrpdmY1hlCUXOxa5wAE19wg=="
#define SC_TEST_GAME_CURRENCY   "YDC"

using namespace std;

SC_Client_h client;
SC_User_h user = NULL;
const char *login = NULL;
bool callbackCalled = false;
SC_Error_t errorCode = 0;

void UserControllerCallback(void * data, SC_Error_t error)
{
  if (error == SC_OK){
    user = SC_Session_GetUser(SC_Client_GetSession(client));
    login = SC_String_GetData(SC_User_GetLogin(user));
  } else {
    errorCode = error;
  }
  callbackCalled = true;
}

int main()
{
  IwGxInit();
  Iw2DInit();

  IwGxSetColClear(0x40, 0x40, 0x40, 0);

  int ErrCode;


  PAL_InitData_t palData;

  ErrCode = SC_Client_New(&client, &palData, SC_TEST_GAME_ID,
                          SC_TEST_GAME_SECRET, SC_TEST_GAME_CURRENCY, NULL);
  SC_UserController_h userController = NULL;

  if (SC_OK == ErrCode){
    ErrCode = SC_Client_CreateUserController(client, &userController,
                                           &UserControllerCallback, NULL);
    if (SC_OK != ErrCode) exit(1);
  }
  ErrCode = SC_UserController_RequestBuddies(userController);

  if (ErrCode != SC_OK) {
    return 1;
  }
  int surface_wid = Iw2DGetSurfaceWidth();
  int surface_hei = Iw2DGetSurfaceHeight();
  int16 boardSize = min(surface_wid, surface_hei);
  int16 inkBtnSize = surface_wid / 6;
  UIBoard uiBoard = UIBoard(20, 20, boardSize, boardSize, CIwSVec2(0, 0));
  BasicBoard board = BasicBoard(20, 20, &uiBoard);
  UIInkButtons inkButtons = UIInkButtons(CIwSVec2(0, surface_hei - inkBtnSize),
                                         inkBtnSize, &board);
  uiBoard.setTiles(board.getTiles());

  s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)&Touch::smileysurprised:nTouch,
                     NULL);


  while(!s3eDeviceCheckQuitRequest()){
    surface_wid = Iw2DGetSurfaceWidth();
    surface_hei = Iw2DGetSurfaceHeight();
    s3eKeyboardUpdate();

    if (s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN){
      break;
    }

    IwGxClear(IW_GX_COLOUR_BUFFER_F | IW_GX_DEPTH_BUFFER_F);

    uiBoard.draw();
    inkButtons.draw();

    if (callbackCalled){
        if (NULL == login){
            if (NULL == user){
                char buffer[16];
                sprintf(buffer, "%d", errorCode);
                IwGxPrintString(200, 200, buffer);
            } else {
                IwGxPrintString(200, 200, "No login got!");
            }
        } else {
            IwGxPrintString(200, 200, login);
        }
    } else {
        IwGxPrintString(200, 200, "Waiting...");
    }
    Iw2DSurfaceShow();

    s3eDeviceYield(10);
  }
  s3ePointerUnRegister(S3E_POINTER_BUTTON_EVENT, (s3eCallback)&Touch::smileysurprised:nTouch);

  Iw2DTerminate();
  IwGxTerminate();

  return 0;
}

 

I think in theory the SC_UserController_RequestBuddies(userController) function call should be place in the UserControllerCallback() callback function, but if I did that the callback function is never called. On my Playbook after a while the number 100 is printed on the screen. I look it up and it's the SC_HTTP_SERVER_ERROR. Yesterday I deployed the exact same code to a HTC Android phone and a player login is printed on the screen so I think the code is fine.

 

Regards,

 

Sean

Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Scoreloop SDK - SC_HTTP_SERVER_ERROR

The code looks ok.

What I am really puzzled with it is it works one one PB and does not on another one.

BTW the fact that this code works on Android should not prove anything as even between BB10 and Playbook ScoreLoop API is a bit different.