473,326 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Javascript XMLResponse returning null

I have read dozens of existing responses on threads, that span the last 5 years or so, concerning this problem and while there are many solutions that appear to work for others - none work for me.

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
  1. ...
  2. function alertContents() {
  3.    if (http_request.readyState == 4) {
  4.       if (http_request.status == 200) {     
  5.          alert(http_request.readyState);
  6.          alert(http_request.status);
  7.          alert(http_request.getAllResponseHeaders()); 
  8.          alert(http_request.responseText);
  9.          alert(http_request.responseXML);
  10. ...
The alerts give the following outputs.

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?
Jul 3 '10 #1
2 2521
acoder
16,027 Expert Mod 8TB
Check out the XMLHttpRequest responses in Firebug (Firefox Add-on).
Jul 8 '10 #2
I found the problem - somewhere else in the script, before the request is made, there is a line that was forcing the mime type to be interpreted as text/html regardless of what the returned mime type was declared as. Removing that line fixed the problem.
Jul 9 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Sara | last post by:
We have a Cobol stored procedures on DB2 OS/390. We are able to access the stored procedures from a distributed platform Windows 2000/ Linux / Unix using DB2 Connect. But it does not return column...
0
by: Atul | last post by:
I have a .Net Managed C++ wrapper control for a MFC control. When using the ..Net control in a Visual Studio 2005 Beta 2 C# project and running in Debug mode, I get a crash saying something like...
0
by: George Durzi | last post by:
cross posted in datagrid group. Inside <columns/> in my datagrid, I have the following template column <asp:templatecolumn HeaderText="To Be Completed By"> <itemtemplate> <asp:Label...
9
by: Thomas Mlynarczyk | last post by:
Hi, It seems to be a generally adopted convention to have a function return FALSE in case of an error. But if a function is supposed to return a boolean anyway, one cannot distinguish anymore...
1
by: Anup | last post by:
Hi Group, I have a datagrid with dropdown in my application. I want to fill the data in dropdown by an ArrayList for that I am using "e.Item.FindControl("DropdownId")" but this function is...
5
by: anupamjain | last post by:
Tired, Exhausted, searched the web, usenets,forums thorughly but still clueless. I guess it's time to post on the group : This is the issue I have been trying to resolve since today morning : ...
2
by: ashish ranjan | last post by:
Hi there, I want to fetch data from database ,convert it in xml then send this xml from server.In Javascript file i am trying to parse it and bind these data to some control like textbox in...
3
by: rrpbatni | last post by:
Hi, I have a doubt in C++ where my method setlocale which is passed with two parameters LC_ALL and data_file_locale string for Portuguese locale is failing and returning NULL… What might be the...
14
by: drdeath89 | last post by:
Im writing some Javascript code that requires me to loop all child nodes and sub child nodes of a certain parent node and execute a function with the child node in question. I decided to write a...
1
by: sbowman | last post by:
I have the following CASE statement in a view: (SELECT CASE WHEN ISNULL(.., NULL) = NULL THEN .(..) ELSE .(..) + ', ' + .. END) AS ContactNameAndTitle It works perfectly when...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.