+ printf("\n\n\tcallback is called\n\n");
+
+ ClientRequstInfo *info = GetClientRequestInfo(clientRequstList, handle);
+
+ if (info)
+ {
+ int idx;
+
+ unsigned char *responseJson;
+ responseJson = (unsigned char *) OCMalloc(
+ (unsigned int) (strlen((char *) clientResponse->resJSONPayload) + 1));
+
+ // We need the body of response.
+ // Copy the body from the response
+ strcpy((char *) responseJson, ((char *) clientResponse->resJSONPayload
+ + OC_JSON_PREFIX_LEN));
+ idx = strlen((char *) responseJson) - OC_JSON_SUFFIX_LEN;
+ // And insert NULL at the end of body.
+ (responseJson[idx]) = 0;
+
+ OCEntityHandlerResponse response = { 0 };
+ response.ehResult = OC_EH_OK;
+ response.payload = responseJson;
+ response.payloadSize = (unsigned int) strlen((char *) responseJson) + 1;
+ response.persistentBufferFlag = 0;
+ response.requestHandle = (OCRequestHandle) info->ehRequest;
+ response.resourceHandle = (OCResourceHandle) info->collResource;
+
+ OCDoResponse(&response);
+
+ RemoveClientRequestInfo(&clientRequstList, info);
+ OCFree(responseJson);
+ }