Skip to main content
14-Alexandrite
November 14, 2023
Solved

CSDK get xml param from remote service

  • November 14, 2023
  • 1 reply
  • 1846 views

Hello,

I implemented a remote service on c sdk. the service have a xml parameter

service(XML param) 

when i run the service from edge, i use twInfoTable_GetString function.:

 

 

 

enum msgCodeEnum implementedService(const char* entityName, const char* serviceName, twInfoTable* params, twInfoTable** content, void* userdata) {
 char* param;
 int res;
 TW_LOG(TW_TRACE, "implementedService- Function called");
 if (!content) {
 TW_LOG(TW_ERROR, "implementedService- NULL params or content pointer");
 return TWX_BAD_REQUEST;
 }

 /* Get properties read into local variables */
 twInfoTable_GetString(params, "param", 0, &param);
.........
...........
}

 

 

 

It worked until I put as parameter a long xml text (5000 characters).

The twInfoTable_GetString  truncate the text and i cannot have the whole parameter.

Do you have any idea how to get the whole param even when t's too long ?

Thank you for your help

Best answer by TonyZhang

Hi @AliBenBelgacem ,

 

Looks like this issue is related to https://www.ptc.com/en/support/article/CS365049

Could you please try the following workaround as mentioned in the article resolution?

  1. Within the ThingWorx C-SDK, under src\utrils open the stringUtils.h file
  2. Locate the following line:
    • #define MAX_STR_LEN 65536
  3. Update this line as follows:
    • #define MAX_STR_LEN <Desired Max String Length>
  4. Recompile the C-SDK and retest calls which would have previously hit the MAX_STR_LEN value

1 reply

TonyZhang16-PearlAnswer
16-Pearl
November 16, 2023

Hi @AliBenBelgacem ,

 

Looks like this issue is related to https://www.ptc.com/en/support/article/CS365049

Could you please try the following workaround as mentioned in the article resolution?

  1. Within the ThingWorx C-SDK, under src\utrils open the stringUtils.h file
  2. Locate the following line:
    • #define MAX_STR_LEN 65536
  3. Update this line as follows:
    • #define MAX_STR_LEN <Desired Max String Length>
  4. Recompile the C-SDK and retest calls which would have previously hit the MAX_STR_LEN value