I apologize to everyone for not getting back sooner.
Anyway, as you know error 415 is a media type error. Quite vague error description. They should rather rename it to Content-Type error, this is because error 415 related to the content type in the HTTP Header.
If any one who has this error, sniffs the HTTP Request, they will see the content type is not been set.
Initially, I thought the content type will be set by the following request (below), where the parameter 'types' is.
hconnection = WinHttpOpenRequest(hsession,
L"POST",
L"/findme.asmx",
NULL,
L"https://test.myservice.com/findme.asmx",
types,
WINHTTP_FLAG_SECURE);
However this is not so.
The Content-Type must be set using the WinHttpAddRequestHeaders function.
EG:
temp = "Content-Type: text/xml; charset=utf-8";
Result =
WinHttpAddRequestHeaders(hInternet, //Request Handle
CT2W(temp.GetBuffer()), //Header
temp.GetLength(), //Header Length
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE);
//Flags --> Add or Replace
This should sort out error 415.