I'm not nearly as familiar with Mozilla's client-side support as IE's, so this may not be the best answer, but here are a few things that I found that seemed to work after playing with it for a bit.
First, you were specifying false for the third parameter of the XML HTTP request open method, which means to not call open asynchronously. As far as I can tell, if you specify that open should be called synchronously, the event handler for onreadystatechange will not be called in Mozilla. Changing this to true caused the event handler (in your case, xmlHttp_change) to start getting called in Mozilla.
The next problem that I saw is that you were trying to get elements named 'xml' with the getElementsByTagName method, but the XML that's coming back from the web service looks like this:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<soap:Body>
<GetSampleDataResponse xmlns="http://tempuri.org/TestWebService/Service1">
<GetSampleDataResult><table cellspacing='0' width=730px cellpadding='4' rules='all' bordercolor='#990000' border='2' style='background-color:White;border-color:#CC9966;border-width:1px;border-style:None;font-family:Times New Roman;font-size:X-Small;border-collapse:collapse;'><tr style='color:white;background-color:darkblue;font-weight:bold;'><TH align='left'>Name1</TH><TH align='left'>Name2</TH><TH align='left'>Name3</TH></TR><TR borderColor='#990000'style='color:red;font-size:X-Small '><TD align='left'>Test1</TD><TD align='left'>Test2</TD><TD align='left'>Test3</TD></TR></TABLE>
</GetSampleDataResult>
</GetSampleDataResponse>
</soap:Body>
</soap:Envelope>
There are no elements named 'xml' here. One way that you can get to the content in IE is like this:
var content = xmlResponse.selectSingleNode("soap:Envelope/soap:Body/GetSampleDataResponse/GetSampleDataResult").text;
Unfortunately, Mozilla's XMLDocument class doesn't support selectSingleNode. I couldn't find a good reference on Mozilla's XMLDocument object, so I tried using just W3C DOM methods. To determine the W3C DOM methods, I looked at the
MSXML reference on
MSDN and looked at the members that did not have a * next to them. The main page that I looked at was for
IXMLDOMNode, which describes the API members for a DOM node. It seems like there should be a better way to do this, but here is one way I was able to get to the content in Mozilla:
var envelopeElement = xmlResponse.childNodes.item(0);
var bodyElement = envelopeElement.childNodes.item(0);
var sampleDataResponseElement = bodyElement.childNodes.item(0);
var sampleDataResultElement = sampleDataResponseElement.childNodes.item(0);
var content = sampleDataResultElement.childNodes.item(0).nodeValue;
Once you have the data in the content variable, you can update the HTML as you were before:
document.getElementById('lblDataUpdate').innerHTML = content;
I was able to get the web service call working in both IE and Mozilla with the code above, so hopefully this helps. Another option that you may want to look at is looking at each browser's support for web services instead of using XMLHTTP. For IE, see the
WebService behavior. For Mozilla, see
Mozilla's web services support page.
- Elton