PDA

View Full Version : Help: Can't get Ajax with XML Forms working in Firefox using IIS 7.0



martin_adams2000
6 Apr 2008, 12:45 PM
Hi all,

I've been trying to run the latest samples on my local IIS setup running on Vista. I've run into a very strange problem which I don't know where the problem lies.

Firstly, I tried running the Ajax with XML Forms (http://extjs.com/deploy/dev/examples/form/xml-form.html) sample on my local IIS setup and found that it wasn't loading the data and there was no errors reported.

Upon further investigation, I noticed that the XML file that was being requested, was getting generating the server error 405 - method not supported. This is because it was sending a HTTP POST to an XML file, and IIS rejects this as it will only serve the XML file using a GET request.

So, I thought I would generate the following PHP script (which accepts a POST) to return the XML content - since this will closely match what I want to do in the long run.

xml-form.php


<?php
header('Content-Type: text/xml');
readfile('xml-form.xml');
?>


I then changed the xml-form.js file to call xml-form.php instead of xml-form.xml.

However, now when I run this using FireFox 2.0.0.13 and monitor what response comes back using Firebug, it shows the server is responding with the following:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>


Now, I've tried the exact same change in IE 7, and this works no problem. Does anyone know what might be causing this problem and why it might be specific to Firefox?

Many thanks in advance.

martin_adams2000
6 Apr 2008, 1:02 PM
Okay, looks like this thread (http://extjs.com/forum/showthread.php?t=8217&highlight=Error+411) might shed some light on the problem.

So if you're posting an empty set of data, which for requesting a file using POST would be doing, then FireFox will miss out the Content-Length or something.

So, my solution for the time being is to change the request method to GET for simply requesting the XML file, or a PHP script. I can still send data back using POST as this will contain data, keeping Firefox happy.

If anyone else has any better solutions, I'd love to hear.

Many thanks.