CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2007
    Posts
    7

    MSXML2 IServerXMLHTTPRequestPtr and no internet connection

    Hi,
    I'm using MSXML2::IServerXMLHTTPRequestPtr to send a request. When I have no internet connection, I get an exception.

    My code:

    xmlHttp.CreateInstance(MSXML2::CLSID_ServerXMLHTTP);
    xmlHttp->open("GET", url, variant_t(false));
    xmlHttp->setRequestHeader("Accept-Language", "en-US");
    xmlHttp->send();

    When I use it and there's no internet connection, I get a 0xE0000001 exception, while in xmlHttp->send(), from this code:
    inline void _bstr_t:: Data_t::_Free() throw()
    {
    if (m_wstr != NULL) {
    ::SysFreeString(m_wstr);
    ...
    }

    Any ideas?

    Thanks,
    yakobom

  2. #2
    Join Date
    Jan 2009
    Posts
    596

    Re: MSXML2 IServerXMLHTTPRequestPtr and no internet connection

    You are trying to send a request without an internet connection, so the code throws an exception. What else can the code do?

  3. #3
    Join Date
    Dec 2007
    Posts
    7

    Re: MSXML2 IServerXMLHTTPRequestPtr and no internet connection

    Well, I have no problem with that (altough it could simply fail). But it seems as if it's trying to access and release a memory that does not exist - m_wstr contains garbage...

    yakobom

  4. #4
    Join Date
    Jan 2009
    Posts
    596

    Re: MSXML2 IServerXMLHTTPRequestPtr and no internet connection

    Quote Originally Posted by yakobom View Post
    Well, I have no problem with that (altough it could simply fail). But it seems as if it's trying to access and release a memory that does not exist - m_wstr contains garbage...

    yakobom
    One of these function calls:
    Code:
    xmlHttp.CreateInstance(MSXML2::CLSID_ServerXMLHTTP);
    xmlHttp->open("GET", url, variant_t(false));
    xmlHttp->setRequestHeader("Accept-Language", "en-US");
    is probably returning an error code to indicate it can't connect. When you go ahead and call xmlHttp->send() anyway, the code is assuming the connection was set up correctly. If it isn't, it goes wrong.

    You should always check error return values.

  5. #5
    Join Date
    Dec 2007
    Posts
    7

    Re: MSXML2 IServerXMLHTTPRequestPtr and no internet connection

    You are right. But I have tried it, and all functions return S_OK. Any other ideas?

    yakobom

  6. #6
    Join Date
    Jan 2009
    Posts
    596

    Re: MSXML2 IServerXMLHTTPRequestPtr and no internet connection

    Sorry - I don't know the API you are using so I can't give specific help on these functions.

    Maybe someone else here does?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured