Click here to Skip to main content
15,920,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to POST data using WinInet on HTTPS(SSL), web service. I have used following sequence of function calls with all the required parameter.
I have checked the return value for all the functions and it returns true for all functions. My request reaches the web service properly but the strange thing is web service is not getting the DATA i have sent using POST method.
One observation from my side is, even though HttpOpenRequest() returns NON NULL value(mean success), If I try to read GetLastError(), it gives 122 error saying insufficient buffer. My URL is hardy of 50 characters.
Can any one help me out understanding what seems to be the problem.

C++
HINTERNET connect = InternetOpen("MyBrowser",INTERNET_OPEN_TYPE_PRECONFIG,NULL, NULL, 0);
Connection = InternetConnect(Initialize, L"abc.efg.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
File = HttpOpenRequest(
    Connection,
    L"POST",
    L"/MyService",
    L"HTTP/1.0",
    NULL,
    NULL,
    INTERNET_FLAG_SECURE, 
    0);

bool res = HttpSendRequest(
    File,  // file to which reply will come
    (LPCWSTR)hdrs, 
    0,
    (char*)frmdata,   // post variables to be send
    dataLen);          // length of data send


Please help

Regards,
Mahesh
Posted
Updated 21-Mar-21 23:43pm
v3

1 solution

googling the same problem points to setting the headers correctly
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900