Problem with XMLHTTP request. Please help! (long)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Cholewa

    Problem with XMLHTTP request. Please help! (long)

    Hi

    I'm using Microsoft.XMLHT TP object from within JavaScript HTA
    application (or WScript).
    Object is set to use asynchronous mode as following:

    ---------
    var oXMLRequest = new ActiveXObject(" Microsoft.XMLHT TP");
    var sURL = "http://www.url.com/page.jsp";
    var sParams = "param1=val ue";

    function send()
    {
    oXMLRequest.Ope n("POST", sURL, true);
    oXMLRequest.set RequestHeader(" Content-type",
    "applicatio n/x-www-form-urlencoded");
    oXMLRequest.onr eadystatechange =sendHandler;
    oXMLRequest.Sen d(sParams );
    }

    function sendHandler()
    {
    alert(oXMLReque st.readyState);
    }
    ---------

    The point is, destination page is doing redirect sending back '302
    Moved Temporarily' status.
    Above code runs well if redirection is made to the same host as
    specified in 'sURL' variable.
    But in case target for the redirection is different, status number '4'
    is never displayed.
    Statuses 1, 2 and 3 are displayed in both cases.

    Below is listening in case the code works:

    ---------
    POST /page.jsp HTTP/1.0
    Accept: */*
    Accept-Language: pl
    Referer: app.hta
    Content-Type: application/x-www-form-urlencoded
    Connection: Close
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET
    CLR 1.1.4322)
    Host: www.url.com
    Content-Length: xx
    Pragma: no-cache

    Data found after header end:

    param1=value


    HTTP/1.1 302 Moved Temporarily
    Server: Netscape-Enterprise/4.1
    Date: Tue, 23 Nov 2004 20:18:39 GMT
    Location: http://www.url.com/log.jsp?error=2
    Content-length: 0
    Content-Type: text/vnd.wap.wml
    Info: Manualy changed
    Connection: close



    GET /log.jsp?error=2 HTTP/1.0
    Accept: */*
    Accept-Language: pl
    Referer: app.hta
    Content-Type: application/x-www-form-urlencoded
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET
    CLR 1.1.4322)
    Host: www.url.com
    Connection: Close


    HTTP/1.1 200 OK
    Server: Netscape-Enterprise/4.1
    Date: Tue, 23 Nov 2004 20:18:40 GMT
    Content-Type: text/html; charset=iso-8859-2
    Set-Cookie: JSESSIONID=Bjbg 8YrHXDpvPhJs1M1 8PVj59sn2kSvLBS ly7aeGZqokoHEfe 4G1!1374542120!-1062708702!7001 !-1;
    path=/
    Connection: close

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    ....
    ---------


    and here it does not:


    ---------
    POST /page.jsp HTTP/1.0
    Accept: */*
    Accept-Language: pl
    Referer: app.hta
    Content-Type: application/x-www-form-urlencoded
    Connection: Close
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET
    CLR 1.1.4322)
    Host: www.url.com
    Content-Length: xx
    Pragma: no-cache

    Data found after header end:

    param1=value


    HTTP/1.1 302 Moved Temporarily
    Server: Netscape-Enterprise/4.1
    Date: Tue, 23 Nov 2004 20:21:41 GMT
    Location: http://www.new_url.com/log.jsp?error=2
    Content-length: 0
    Content-Type: text/vnd.wap.wml
    Info: Manualy changed
    Connection: close



    GET /log.jsp?error=2 HTTP/1.0
    Accept: */*
    Accept-Language: pl
    Referer: app.hta
    Content-Type: application/x-www-form-urlencoded
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET
    CLR 1.1.4322)
    Host: www.new_url.com
    Connection: Close


    HTTP/1.1 200 OK
    Date: Tue, 23 Nov 2004 20:21:42 GMT
    Server: Apache/1.3.33 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7e
    Connection: close
    Content-Type: text/html; charset=iso-8859-1

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    ....
    ---------


    Any help would be appreciated?

    Greetings,
    Rob
  • Bradley  Baumann

    #2
    Re: Problem with XMLHTTP request. Please help! (long)

    Seems to be something server-side. I don't see anything wrong with your
    JavaScript code.

    Comment

    Working...