Solved

msxml4.dll Question

Posted on 2003-10-27
12
732 Views
Last Modified: 2007-12-19
Hello,

I have an javascript function. I am using this function to post the xml to servlet. I installed the MSXML4 and it was working fine. All of sudden today it is giving me the following error message

C:\JScript\myscript.js(7, 2) msxml4.dll: The download of the specified resource has failed.

at this line "xmlhttp.Send(xmldoc);" in the following code.

function PostUser(xmldoc) {    
      var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
      xmlhttp.Open(      "POST",
                  "http://mycompany.com/myServlet",
                  false
                );
      xmlhttp.Send(xmldoc);
      return xmlhttp.responseXML;
}

I need to fix this sooner. because alot of other things are depending on this to work.

I appreciate your help. Please let me know.

thank you,
alagappanK
0
Comment
Question by:alagappanK
  • 4
  • 4
  • 4
12 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 9627978
Can you load     http://mycompany.com/myServlet
in the browser?
0
 

Author Comment

by:alagappanK
ID: 9627994
No. Its a common servlet for the company. I just tried to load it in the browser. It is not showing any thing. This servlet is functioning with the MQ Series. the xml I am sending this servlet, goes to the MQSeries queue and then the servlet will pick up this xml and process it and return the result xml.

thank you,
alagappanK
0
 
LVL 25

Expert Comment

by:devic
ID: 9628068
maybe connecttion speed to the server today is bad, and you don't get readyState:

try this:
=========================================================
<script>
var xmlhttp=null;
function PostUser(xmldoc)
{
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
  xmlhttp.Open("POST", "http://mycompany.com/myServlet", false);
  xmlhttp.onreadystatechange=HandleStateChange;
  xmlhttp.Send(xmldoc);

}
function HandleStateChange()
{
  alert("xmlhttp.readyState="+xmlhttp.readyState);
  if (xmlhttp.readyState==4)
  {
   alert(xmlhttp.responseXML);
  }
}
</script>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 9628488
Hey devic, could you perhaps look at the last question here too?
http://www.experts-exchange.com/Web/Web_Languages/XML/Q_20775977.html
thanks
0
 

Author Comment

by:alagappanK
ID: 9628627
I just run the script with what you given, and for alert() I use the following function

 function alert(str) {
   WScript.Echo(str);
 }

I am getting the following error

xmlhttp.readyState=2
xmlhttp.readyState=3
xmlhttp.readyState=4
C:\JScript\myjscript.js(92, 4) Microsoft JScript runtime error: Type mismatch

The type mismatch is in the alert Function. (WScript.Echo(str);)

Is my alert function is wrong ??

please let me know.
thank you,
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 9628640
I would not call it alert. . But anyway try
  if (str) WScript.Echo(str);
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 25

Expert Comment

by:devic
ID: 9628685
hi mplungjan, ok i look this.
must be js? or i can use vbs.
for asp i use always vbs.
0
 

Author Comment

by:alagappanK
ID: 9628717
Hello  devic,

Now its working fine. Can you please tell me why my original code is not working. But After I include this

HandleStateChange()

it works fine. What is the coding standard. Do you think I should include the HandleStateChange() in my code.

please let me know.

I appreciate your help
alagappanK
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 9628729
Sorry AlagappanK for commenting in your question: Devic: Yes please JS only. Or vbs I can convert.. But I see now more people are commenting. It was quiet for many days
0
 
LVL 25

Accepted Solution

by:
devic earned 500 total points
ID: 9629032
the problem is, that if readyState=4, then you can get xmlhttp.responseXML
maybe earlier you had better connection with server and it worked.

anyway, better check readyState and then ask for xmlhttp.responseXML.

here is code with your "return"
=================================
<script>
var xmlhttp=null;
var resxml;
function PostUser(xmldoc)
{
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
  xmlhttp.Open("POST", "http://mycompany.com/myServlet", false);
  xmlhttp.onreadystatechange=HandleStateChange;
  xmlhttp.Send(xmldoc);
  return resxml;
}
function HandleStateChange()
{
  if (xmlhttp.readyState==4)
  {
   resxml= xmlhttp.responseXML;
  }
}
</script>


0
 
LVL 25

Expert Comment

by:devic
ID: 9641858
alagappanK, how are you?
0
 

Author Comment

by:alagappanK
ID: 9642470
Good Morning devic,

Thank you for your help. I truly appreciate it.

alagappanK
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
rhino JavaScript import, load 25 66
Where do I learn ES6? 3 48
Google Map JavaScript API 4 39
Open Attachment from within List Field in SharePoint Online 1 25
Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now