cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

call Service on Composer from C SDK

AnnaAn
13-Aquamarine

call Service on Composer from C SDK

Hi,

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(labelField);

                    printf("parentField is: ");

                    printf(parentField);

                }

            }

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!

Thanks,

Br,

Anna

0 REPLIES 0
Top Tags