- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Iam new to IBM bluemix cloud...I want to send data from WIFI module to cloud foundry apps in bluemix cloud via HTTP_POST method.. In cloud foundry app python server program will be running.. I referred httpbin_org.c program.. I have modified server name and uri to url of the app and changed the request format to
wiced_JSON_parser_register_callback(parse_http_response_info);
header[0].field = HTTP_HEADER_HOST;
header[0].field_length = sizeof( HTTP_HEADER_HOST ) - 1;
header[0].value = SERVER_NAME;
header[0].value_length = sizeof( SERVER_NAME ) - 1;
header[1].field = HTTP_CONNECTION;
header[1].field_length = sizeof( HTTP_CONNECTION ) - 1;
header[1].value = keepalive;
header[1].value_length = sizeof( keepalive ) - 1 ;
header[2].field = HTTP_HEADER_CONTENT_TYPE;
header[2].field_length = sizeof( HTTP_HEADER_CONTENT_TYPE ) - 1;
header[2].value = CONTENT_TYPE;
header[2].value_length = sizeof( CONTENT_TYPE ) - 1;
snprintf(content_length_buffer,content_length_buffer_size,"%d",sizeof(MESSAGE)-1);
header[3].field = HTTP_HEADER_CONTENT_LENGTH;
header[3].field_length = sizeof( HTTP_HEADER_CONTENT_LENGTH ) - 1;
header[3].value = content_length_buffer;
header[3].value_length = strlen( content_length_buffer );
header[4].field = HTTP_CLRF;
header[4].field_length = sizeof( HTTP_CLRF ) - 1;
header[4].value = MESSAGE;
header[4].value_length = sizeof( MESSAGE ) - 1;
http_request_init( &requests[0], &client, HTTP_POST, request_uris[0], HTTP_1_1 );
http_request_write_header( &requests[0], &header[0], 5 );
http_request_write_end_header( &requests[0] );
http_request_flush( &requests[0] );
But from the event_handler iam not getting any response from the server.. Why Iam not able to connect the cloud foundry app..Is there anything I have to change in the server name ,uri or in request format... please help me to solve this issue..Iam stuck up with this for so long time... please help me...Waiting for the reply..
Thank you...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>header[1].value = keepalive;
>>header[1].value_length = sizeof( keepalive ) - 1 ;
Can you confirm keepalive is a variable? If yes, then that is your problem.You need to convert it into a string.
If no, then please attach full .c file and let us know version of WICED Studio that you are using.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can refer to this forum post How to use HTTP POST request in WICED Studio 4.0.1? to see how to use HTTP post. You need to use http_request_write() to actually post data to the HTTP server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>header[1].value = keepalive;
>>header[1].value_length = sizeof( keepalive ) - 1 ;
Can you confirm keepalive is a variable? If yes, then that is your problem.You need to convert it into a string.
If no, then please attach full .c file and let us know version of WICED Studio that you are using.