storing contents of XML file into CString for WinInet functionality

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skysurf
    New Member
    • Oct 2006
    • 1

    #1

    storing contents of XML file into CString for WinInet functionality

    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.SendR equest 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:
    -----------------------------------------------------------------

    CInternetSessio n session("My Session");
    CHttpConnection * pServer = NULL;
    CHttpFile* pFile = NULL;
    CString strServerName = "stbupdatetg.st reamingmxd.de";
    CString strServerFile = "Update.asp x";
    CString strHeaders;
    CString xml_content_str ing;

    INTERNET_PORT nport = SECURE_INTERNET _PORT;

    try
    {
    pServer = session.GetHttp Connection(strS erverName, INTERNET_FLAG_S ECURE, nport);
    pFile = pServer->OpenRequest(CH ttpConnection:: HTTP_VERB_POST, strServerFile, NULL, 1, NULL, NULL, INTERNET_FLAG_S ECURE);



    // ********** Here is where I need to parse the xml file into and store it's contents into the xml_content_str ing!! BUT HOW????******** **



    DWORD dwRewLen = xml_content_str ing.GetLength() ;
    strHeaders.Form at(_T("Content-Type: text/xml; charset=utf-8\nContent-Length:%d"),
    dwRewLen);

    pFile->SendRequest(NU LL, 0, (LPVOID)(LPCTST R)xml_content_s tring, dwRewLen);

    }

    The name of the XML file is "SampleUpdateRe quest.xml" and it's size is only 1Kb.

    I would appreciate any help!!!!
Working...