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
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? :confused:
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
Re: MSXML2 IServerXMLHTTPRequestPtr and no internet connection
Quote:
Originally Posted by
yakobom
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.
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
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?