I have some Javascript that is receiving an XML file from a Servlet. The problem is that the XMLResponse always returns a null value.
Here is some the code snippet:
Expand|Select|Wrap|Line Numbers
- ...
- function alertContents() {
- if (http_request.readyState == 4) {
- if (http_request.status == 200) {
- alert(http_request.readyState);
- alert(http_request.status);
- alert(http_request.getAllResponseHeaders());
- alert(http_request.responseText);
- alert(http_request.responseXML);
- ...
4
200
Date: Sat, 03 Jul 2010 08:44:44 GMT
Content-Length: 271
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=ISO-8859-1
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Console ConsoleType="ErrorConsole"><ConsoleName>Server Error</ConsoleName><ErrorMessage>The Console servlet requires a consoleType parameter. This parameter was not found in the URL request.</ErrorMessage></Console>
null
As you can see, the content type iss text/xml. Pasting the XML into a validator gives a valid response. I really have no idea why the XMLResponse is returning null - there doesn't appear to be any reason to fail.
Using IE, the errorCode is 0, so there is no help there.
There does not appear to be any other way to debug this.
Any suggestions?