Xampp Xml http requests seems to fail all the time how do I

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Xampp Xml http requests seems to fail all the time how do I

Postby rr1024 » 02. August 2010 19:56

Hello, thanks for reading my question, I'm using Xampp for my development server locally. I'm doing some Ajax/Js using
xml.

This code works great on my live linux server but fails 100% of the time on Xampp, it fails at xmlhttp.status==200

So I added the alert box alert('header returned is ' +xmlhttp.getAllResponseHeaders())

so when it fails I get the following from "alert('header returned is"
header returned is Date: Mon, 02 Aug 2010 18:54:50 GMT
Server: Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.6
Vary: accept-language,accept-charset
Accept-Ranges: bytes
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
Content-Language: en


Code: Select all
    xmlhttp.onreadystatechange=function()
    {
        if(xmlhttp.readyState==4)
        {
            if(xmlhttp.status==200)
            {
                document.getElementById("unitconversion_1_msg").innerHTML=successmsg;
                strArray=xmlhttp.responseText.split(",");
                document.getElementById("unitconversion_1_l2").innerHTML=strArray[0];
            }
            else
            {   alert('header returned is ' +xmlhttp.getAllResponseHeaders())
                document.getElementById("unitconversion_1_msg").innerHTML=errormsg;
            }
        }
    };


Does Xampp even do Xml? or is there something I need to turn on in the configuration of apache?
any help would be great.....Again this code works great on a live server
rr1024
 
Posts: 35
Joined: 11. March 2008 04:28

Re: Xampp Xml http requests seems to fail all the time how do I

Postby rr1024 » 02. August 2010 21:36

Hello thanks for the info but sadly that didn't do the trick.
I get the same thing with Chrome, and ie but I don't really consider ie a browser....LOL all three do return the same Failed result
rr1024
 
Posts: 35
Joined: 11. March 2008 04:28

Re: Xampp Xml http requests seems to fail all the time how do I

Postby JonB » 03. August 2010 00:54

my 'guess' is that you have a MIME problem. (but I am unsure at this moment how-to-fix)

Content-Type: text/html; charset=iso-8859-1

I don't think its associated with an XML application directive (therefore doing nothing as the browser does realize this is to be used by an application).

If I'm right on this, the fix is likely an AddType directive in the main httpd.conf.
The defaults are in: \xampp\apache\conf\mime.types

There's another thread with a similar type of issue (but I don't think its the same issue) - his/hers only fails with Firefox, works on IE.

:shock:

You also might try adding your 'dump code' to the code running on that Linux box to see if there's a different or missing value returned from the header.

edit after Googly:
Read through this IBM tip:
http://www.ibm.com/developerworks/xml/l ... index.html

This is ONLY a JonB guess, so I may not be right. (and I am a SERVER Geek, not an XML.AJAX.Javascriot Geek - LOL
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Xampp Xml http requests seems to fail all the time how do I

Postby rr1024 » 03. August 2010 15:56

I added this to my page, and got the same results
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

I looked in here and found text/xml
\xampp\apache\conf\mime.types

so I changed
<meta http-equiv="Content-Type" content="text/xml; charset=utf-8">

This had the same result as before
header returned is Date: Tue, 03 Aug 2010 14:55:34 GMT
Server: Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.6
Vary: accept-language,accept-charset
Accept-Ranges: bytes
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
Content-Language: en

the content type doesn't change as far as i can tell

I also found this in the httpd.conf file
#LoadModule xmlns_module modules/mod_xmlns.so
but when I remove the # then Apache no longer starts
rr1024
 
Posts: 35
Joined: 11. March 2008 04:28

Re: Xampp Xml http requests seems to fail all the time how do I

Postby JonB » 03. August 2010 16:24

This is what I 'think' -

The problem isn't the page the code is in, its the file that contains the XML (is XML encoded). When you attempt to parse that file, it fails - i.e. either the actual encoding is deficient and/or the object is not being recognized as a valid XML object. (could be a case of both, if you are using implicit XML)

Note, I said - 'think' and that is based on my guesswork on the intent of your code. As I am the only geek responding right now, I'd suggest you post on some forums that are developer specific - even if they don't know XAMPP (which is really just Apache + 'parts' really) they may well recognize the symptoms and be in a better position to advise you.

Good Luck
:)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Xampp Xml http requests seems to fail all the time how do I

Postby BigWetDog » 03. August 2010 16:31

JonB,
Back up.
rr1024 stated that his/her code is working when served from a linux installation, but not xampp so I'd say his code is not the problem.

Have you compared your httpd.conf files between the two environments to ensure you are using the same modules. Also compare your php versions. Of course this assumes also that you are access both servers from the same browser. Isolate one step at a time.
User avatar
BigWetDog
 
Posts: 148
Joined: 25. February 2010 15:54

Re: Xampp Xml http requests seems to fail all the time how do I

Postby JonB » 03. August 2010 17:54

BWD -

I never said it was a code problem - its likely a MIME type problem with XAMPP. (provided that the XML file is being served by a XAMPP server). could be almost anything...

And I completely concur that checking the Apache conf's and php.ini files is the right place to start. That's why I suggested 'dumping' the Linux dialogues -

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Xampp Xml http requests seems to fail all the time how do I

Postby BigWetDog » 03. August 2010 18:07

Doh!
User avatar
BigWetDog
 
Posts: 148
Joined: 25. February 2010 15:54

Re: Xampp Xml http requests seems to fail all the time how do I

Postby rr1024 » 03. August 2010 18:14

I'm a he/him....LOL

Thanks, I'll start looking into what both of you mentioned above.
In the mean time here is the js file I use for my ajax

Code: Select all
var xmlhttp;
function CreateAjax()
{
    try
    {
        xmlhttp=new XMLHttpRequest();
    }
    catch(e)
    {
        try
        {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }catch(e)
        {
            try
            {
                xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
            }catch(e)
            {
                alert("Unsupported explorer");
                return false;
            }
        }
    }
}
function unitconversion_1_Func()
{
    var strArray=new Array();
    document.getElementById("unitconversion_1_msg").innerHTML="&nbsp;&nbsp;";
    var unitconversion_1_l1=document.getElementById("unitconversion_1_l1").value;
    if((unitconversion_1_l1=="")||isNaN(unitconversion_1_l1))
    {
        document.getElementById("unitconversion_1_msg").innerHTML=valuemsg;
        return;
    }
    var unitconversion_1_l1_unit=document.getElementById("unitconversion_1_l1_unit").options[document.getElementById("unitconversion_1_l1_unit").selectedIndex].text;
    var unitconversion_1_l2_unit=document.getElementById("unitconversion_1_l2_unit").options[document.getElementById("unitconversion_1_l2_unit").selectedIndex].text;
    var url="unitconversion_1.asp?l1="+unitconversion_1_l1+"&l1_unit="+unitconversion_1_l1_unit+"&l2_unit="+unitconversion_1_l2_unit
    document.getElementById("unitconversion_1_msg").innerHTML=startmsg;
    document.getElementById("unitconversion_1_l2").innerHTML="&nbsp;"
    CreateAjax();
    xmlhttp.open("GET",url,true);
    xmlhttp.onreadystatechange=function()
    {
        if(xmlhttp.readyState==4)
        {
            if(xmlhttp.status==200)
            {
                document.getElementById("unitconversion_1_msg").innerHTML=successmsg;
                strArray=xmlhttp.responseText.split(",");
                document.getElementById("unitconversion_1_l2").innerHTML=strArray[0];
            }
            else
            {   //alert('header returned is ' +xmlhttp.getAllResponseHeaders())
                document.getElementById("unitconversion_1_msg").innerHTML=errormsg;
            }
        }
    };
    xmlhttp.send(null);
}


Here is the Html for the interface to the js posted above

Code: Select all

<script type="text/javascript">
    var valuemsg="&nbsp;&nbsp;Invalid input value!";
    var startmsg="&nbsp;&nbsp;Calculating...";
    var successmsg="&nbsp;&nbsp;Success!";
    var errormsg="&nbsp;&nbsp;Failed!";
</script>

                <p>Imperial units:</p>
                <p>1 inch = 25.4 mm</p>
                <p>1 foot = 30.5 cm</p>
                <p>1 mil = 0.0254 mm</p>
                <p></p>
                <p>Metric units</p>
                <p>1 m = 100 cm</p>
                <p>1 cm = 10 mm</p>
                <p>1 mm = 1000 micron</p>
                <p></p>
                <p>A unit of input, calculation of another:</p>
                 <script language="javascript" type="text/javascript" src="<?=$enImgUrl?>unitconversion.js"></script>
                <table class="ekswaistyle" bgcolor="#ffffce"
cellpadding="5" width="410">
                <tbody><tr>
                    <td width="200">Length 1</td>
                    <td align="center" width="70"><input size="10"
name="unitconversion_1_l1" id="unitconversion_1_l1" type="text"></td>
                    <td width="40"><select size="1"
name="unitconversion_1_l1_unit" id="unitconversion_1_l1_unit"><option>m</option><option>cm</option><option
 selected="selected">mm</option><option>um</option><option>feet</option><option>inch</option><option>mils</option></select></td>
                </tr>
                <tr>
                    <td colspan="3">&nbsp;&nbsp;&nbsp;<input
value="Calculate" onclick="unitconversion_1_Func()" type="submit"><font
color="#ff0000"><span id="unitconversion_1_msg">&nbsp;</span></font></td>
                </tr>
                <tr>
                    <td width="200">Length 2</td>
                    <td align="center" width="70"><span id="unitconversion_1_l2">&nbsp;</span></td>
                    <td width="40">
                    <select size="1" name="unitconversion_1_l2_unit" id="unitconversion_1_l2_unit"><option>m</option><option>cm</option><option
 selected="selected">mm</option><option>um</option><option>feet</option><option>inch</option><option>mils</option></select></td>
                </tr>
                </tbody></table>

                <br>

            </td>


This is only if you interested in this problem too, I'm going to continue to try to figure it out but if someone else wants to jump in then above should be all the code you need ;-), it's just a simple metric to imperal converter...


Thank you both for all your help and direct thus far, it gives me idea's to look into rather than beating my head agianst the wall....LOL
Last edited by rr1024 on 03. August 2010 20:25, edited 1 time in total.
rr1024
 
Posts: 35
Joined: 11. March 2008 04:28

Re: Xampp Xml http requests seems to fail all the time how do I

Postby rr1024 » 03. August 2010 20:23

Ha, I wish...lol
I moved the script over to a live linux server and the script isn't working any more
I get the same header ;-(, so never mind I guess....thanks for all your advice

header returned is Date: Tue, 03 Aug 2010 19:22:38 GMT
Server: Apache mod_fcgid/2.3.5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Content-Type: text/html; charset=iso-8859-1
Content-Length: 500
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
rr1024
 
Posts: 35
Joined: 11. March 2008 04:28


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 50 guests