0 Replies Latest reply on Sep 16, 2015 5:39 AM by anna RSS
    anna Communicator

    call Service on Composer from C SDK


    I want to call a service which is on composer remote thing from C SDK. This is the code I used:


    twInfoTable * it = NULL;

    int res = TW_OK;

    int count = 0;

    res = twApi_InvokeService(TW_THING,"SteamSensor1","getInfoTable", NULL, &it, -1, FALSE);

    if (res) {

                    TW_LOG(TW_INFO," error calling service getInfoTable !");


                } else {

                    /* print data from infotable returned*/


                    if (!it) return;

                    count = twList_GetCount(it->rows);

                    printf("returned "+count);

                    while (count > 0) {

                        char * labelField;

                        char * parentField;

                        twInfoTable_GetString(it, "labelField", count - 1, &labelField);

                        twInfoTable_GetString(it, "parentField", count - 1, &parentField);

                        printf("labelField is:  ");


                        printf("parentField is: ");






    but I didnt get the information printed on console as expected, and program will go to

    if (res) {

                    TW_LOG(TW_INFO," error calling service getInfoTable !");



    which means service call is unsuccessful, and from the console log, I could see it informs "Not Authenticated Yet", I wonder if this is why I cannot call service, but I dont know how to set authentication for calling a service on composer from C SDK, I already set a correct TW_APP_KEY and it can connect successfully to composer just service call would fail.

    Any suggesion or advice would be appreciated!