Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / June 2005



Tip: Looking for answers? Try searching our database.

error creating XMLHttpRequest

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
steveH - 27 Jun 2005 11:42 GMT
Hi, I'm trying to solve a problem for a user which I can neither
reproduce or explain. Here goes in the hope that someone else may have
experienced the same.
I make two attempts to create the XMLHTTP object, using the progids
"Msxml2.XMLHTTP" and (if that fails) "Microsoft.XMLHTTP". If the latter
fails I display the error. The error appearing is ""NULL" is
undefined". I'm still awaiting confirmation of the exact browser
version, but the screenshot I have looks like IE5.5, and the company
info in the titlebar indicates that it's a customised install.
I'm completely out of ideas on this one - no hits whatsoever in google
for this error message in this context.

thanks
Matt Kruse - 27 Jun 2005 12:38 GMT
> I make two attempts to create the XMLHTTP object, using the progids
> "Msxml2.XMLHTTP" and (if that fails) "Microsoft.XMLHTTP". If the
> latter fails I display the error. The error appearing is ""NULL" is
> undefined".

Can you post your code? It's impossible to guess at what the problem is
without seeing your code :)

This is an example of creating the object from my Ajax Toolbox:

/**
* Returns an XMLHttpRequest object, either as a core object or an ActiveX
* implementation. If an object cannot be instantiated, it will return null;
*/
AjaxRequest.getXmlHttpRequest = function() {
 if (window.XMLHttpRequest) {
   return new XMLHttpRequest();
 }
 else if (window.ActiveXObject) {
   // Based on http://jibbering.com/2002/4/httprequest.html
   /*@cc_on @*/
   /*@if (@_jscript_version >= 5)
   try {
     return new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
     try {
       return new ActiveXObject("Microsoft.XMLHTTP");
     } catch (E) {
       return null;
     }
   }
   @end @*/
 }
 else {
   return null;
 }
};

Signature

Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com

VK - 29 Jun 2005 13:54 GMT
I guess it's here:      > new ActiveXObject("Msxml2.XMLHTTP"­);

There is a confusion between the XML Parser (MSXML) and the primitive
DataStream interface (Microsoft.XMLHTTP)

The first one is a real library (msxml2.dll) that can be corrupted,
missing or not registered.

Microsoft.XMLHTTP is an internal call (there is not microsoft.dll), so
"it's always here".

If you do only primitive post/get operations with manual data handling,
you don't need  Msxml2 whatsoever (also on XP SP2 and later this is
msxml3.dll - another possible cause of the problem).

To help your client quickly with the minimum code change: simply
inverse your branches (Microsoft.XMLHT­TP before Msxml2.XMLHTTP)
Jim Ley - 29 Jun 2005 14:06 GMT
>Microsoft.XMLHTTP is an internal call (there is not microsoft.dll), so
>"it's always here".

No it's not!

Jim.
VK - 29 Jun 2005 14:55 GMT
>No it's not!

Just switch the damn branches so Microsoft.XMLHTTP would go first; and
enjoy ever after (if still null, than the istallation of IE is badly
broken on the computer of the question).

My voice is not (at least not always) a voice of the evil.
steveH - 30 Jun 2005 08:11 GMT
if you look at the code, it's always going to try both progids before
it displays the error, so what do you expect switching the order to do,
exactly ?
VK - 30 Jun 2005 11:02 GMT
First of all, it works. If you can admit it, you may read below.
Otherwise please don't pull me in another religious discussion who's
God is better.

MSXML is *XML Parser*. Besides all other things it *may* work as a
server data reader, but it's not what it is done for.

Microsoft.XMLHTTP is a *low level server data reader* (as much as we
can talk about a *low level* in JavaScript).

To visualize the picture, think of a nail you need to put into the
wall; and a microscope and a hammer in front of you. So the question is
what will you take *first* from the table: the microscope (MSXML) or
the hammer (Microsoft.XMLHTTP). You can try to hammer the nail with the
microscope, but it also can fail apart during this operation. Or you
may use the hammer, which is the 100% guarantee (unless you smash your
fingers :-)
Jim Ley - 30 Jun 2005 11:48 GMT
>Microsoft.XMLHTTP is a *low level server data reader* (as much as we
>can talk about a *low level* in JavaScript).

We can't talk about any such thing...   microsoft.xmlhttp and
msxml2.xmlhttp are not different in any way other than their age, and
the version they were installed in Microsoft.xmlhttp was implemented
in MSXML.dll and is old, MSXML2.XMLHTTP is implemented in MSXML2.dll
(or later) and is a bit newer.  They're equivalent otherwise, please
try and understand what you're talking about, you might confuse
people.

>To visualize the picture, think of a nail you need to put into the
>wall; and a microscope and a hammer in front of you. So the question is
[quoted text clipped - 3 lines]
>may use the hammer, which is the 100% guarantee (unless you smash your
>fingers :-)

Except of course this analogy is complete garbage.

Jim.
VK - 30 Jun 2005 12:14 GMT
<http://support.microsoft.com/Default.aspx?id=893659>

*But I Was In The Dark Before*
*And Your God Is Better*

Please take this admission as an acceptable reason to not continue this
conversation.
Martin Honnen - 27 Jun 2005 13:01 GMT
> I make two attempts to create the XMLHTTP object, using the progids
> "Msxml2.XMLHTTP" and (if that fails) "Microsoft.XMLHTTP". If the latter
> fails I display the error. The error appearing is ""NULL" is
> undefined". I'm still awaiting confirmation of the exact browser
> version, but the screenshot I have looks like IE5.5, and the company
> info in the titlebar indicates that it's a customised install.

We need to see your code.
It is possible to disable ActiveX in IE for a zone so that could be a
cause of the problem.

Signature

    Martin Honnen
    http://JavaScript.FAQTs.com/

steveH - 27 Jun 2005 17:05 GMT
Thanks for the replys, here's the code

try {
    var o = new ActiveXObject("Msxml2.XMLHTTP");
    return o;
}
catch (e){
  try {
    var o = new ActiveXObject("Microsoft.XMLHTTP");
    return o;
   }
  catch(e){
       errDialogShow("Error in Calculator","Unable to create
XMLHTTP\n\""+e.message + "\"");
       return null;
  }
}

works for the vast majority of users, works for me in IE6 & IE5.5 (this
is from a factory object, a different object altogether creates FireFox
object). For the problem case, the error message displays (Title)
"Error in Calculator" (Message) Unable to create XMLHTTP "NULL" is
undefined". Any attempt I make to disable activex/uninstall XMLHTTP to
try and reproduce the error just results in the expected message
"Unable to create XMLHTTP Automation server cannot create object"
Matt Kruse - 27 Jun 2005 18:07 GMT
>errDialogShow("Error in Calculator","Unable to create
>XMLHTTP\n\""+e.message + "\"");

>"NULL" is undefined".

Try doing some simple alerts before your Dialog call:

alert(e);
alert(e.message);

to make sure that there's suff in there.

Signature

Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com

steveH - 28 Jun 2005 09:30 GMT
I would if I could, problem is, the issue only occurs for one
particular user (that we know about - I assume there may be more that
haven't reported it), and as Sods law dictates, it's an important user.
I'm not going to be able to use him as a guinea pig, however simple the
test.
We have asked for full details of the browser, I can only hope that we
can reproduce the problem if we can replicate the exact browser
configuration.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.