Hello,
I have been placed on a new project involving development for Windows CE using Visual C++. I have to send an XML file via a SSL connection to a server followed by receiving a corresponding response XML file from the server. I was trying to use the WinInet MFC classes provided with Visual C++ 2005.
The problem is, I have an XML file that I need to send via the post method in the Request to the server. However, I am new to this and not sure how to first store the contents of the XML file into a CString object as the CHttpFile.SendRequest method accepts a pointer to a string as an input for the data to send to the server.
Here's the code that I am trying to use:
-----------------------------------------------------------------
CInternetSession session("My Session");
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
CString strServerName = "stbupdatetg.streamingmxd.de";
CString strServerFile = "Update.aspx";
CString strHeaders;
CString xml_content_string;
INTERNET_PORT nport = SECURE_INTERNET_PORT;
try
{
pServer = session.GetHttpConnection(strServerName, INTERNET_FLAG_SECURE, nport);
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST, strServerFile, NULL, 1, NULL, NULL, INTERNET_FLAG_SECURE);
// ********** Here is where I need to parse the xml file into and store it's contents into the xml_content_string!! BUT HOW????**********
DWORD dwRewLen = xml_content_string.GetLength();
strHeaders.Format(_T("Content-Type: text/xml; charset=utf-8\nContent-Length:%d"),
dwRewLen);
pFile->SendRequest(NULL, 0, (LPVOID)(LPCTSTR)xml_content_string, dwRewLen);
}
The name of the XML file is "SampleUpdateRequest.xml" and it's size is only 1Kb.
I would appreciate any help!!!!