-
April 11th, 2012, 05:08 AM
#1
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
-
April 11th, 2012, 06:02 AM
#2
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?
-
April 11th, 2012, 06:06 AM
#3
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
-
April 11th, 2012, 06:12 AM
#4
Re: MSXML2 IServerXMLHTTPRequestPtr and no internet connection
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.
-
April 11th, 2012, 06:26 AM
#5
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
-
April 11th, 2012, 06:51 AM
#6
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|