473,782 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript XMLResponse returning null

2 New Member
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="Er rorConsole"><Co nsoleName>Serve r Error</ConsoleName><Er rorMessage>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 2538
acoder
16,027 Recognized Expert Moderator MVP
Check out the XMLHttpRequest responses in Firebug (Firefox Add-on).
Jul 8 '10 #2
aaronharwood
2 New Member
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
1554
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 names. It returns only column numbers. When we try to retrieve the metadata of resultset , it is returning NULL for column names or any other meta data from ResultSetMetaData Object. Can you please advise how to resolve this problem. Thanks...
0
2118
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 "First Chance Exception : memory cannot be read". I found that this was becuase a call to AfxGetThread() was returning NULL. I tried using AFX_MANAGE_STATE(AfxGetStaticModuleState()); but it did not solve the problem. Furthermore, this crash only...
0
2204
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 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.FULL_NAME") %>'><asp:label> </itemtemplate> <edititemtemplate>
9
5213
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 between the "normal" FALSE and the "error" FALSE. So why not using NULL instead to indicate an error? Are there drawbacks I am not aware of? Greetings, Thomas
1
2878
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 returning NULL THUS I m getting exception "Object Refrence not set to an Instance to Object", Here is the code I wrote (ASP.NET 1.1)...
5
9779
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 : I have an XHTML document in string form which I parse using Xerces DOMParser (using an InputSource to read it). Now I am trying to get to a node for which I have the Xpath, using the XPathAPI.
2
10641
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 client page.But the xmlHttp.responseXML.documentElement returned from server is showing null: I m using .Net,C#,(Ajax) ******************************************************** code snippet: serverPage.aspx.cs...
3
3128
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 probable reasons… Can you please let me know…???
14
2021
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 recursive function with said functionality, with a node and a function as parameters, but it simply wont work. My problem is that whenever i pass a node to this function parameter it is always, regardless of what i change, equal to null. I even...
1
7470
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 dbo.tblContact.JobTitleID is NOT null. When it
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.