Problem with XMLHTTP request. Please help! (long)

Discussion in 'Javascript' started by Robert Cholewa, Nov 23, 2004.

  1. Hi

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

    ---------
    var oXMLRequest = new ActiveXObject("Microsoft.XMLHTTP");
    var sURL = "http://www.url.com/page.jsp";
    var sParams = "param1=value";

    function send()
    {
    oXMLRequest.Open("POST", sURL, true);
    oXMLRequest.setRequestHeader("Content-type",
    "application/x-www-form-urlencoded");
    oXMLRequest.onreadystatechange=sendHandler;
    oXMLRequest.Send(sParams );
    }

    function sendHandler()
    {
    alert(oXMLRequest.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=Bjbg8YrHXDpvPhJs1M18PVj59sn2kSvLBSly7aeGZqokoHEfe4G1!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
    Robert Cholewa, Nov 23, 2004
    #1
    1. Advertising

  2. Seems to be something server-side. I don't see anything wrong with your
    JavaScript code.
    Bradley Baumann, Dec 19, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    672
    Eric Sosman
    Jul 8, 2003
  2. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,184
    Peter Shaggy Haywood
    Sep 20, 2005
  3. Mathieu Dutour

    long long and long

    Mathieu Dutour, Jul 17, 2007, in forum: C Programming
    Replies:
    4
    Views:
    471
    santosh
    Jul 24, 2007
  4. Bart C

    Use of Long and Long Long

    Bart C, Jan 9, 2008, in forum: C Programming
    Replies:
    27
    Views:
    796
    Peter Nilsson
    Jan 15, 2008
  5. yawnmoth

    Msxml*.XMLHTTP vs. Microsoft.XMLHTTP

    yawnmoth, Nov 7, 2006, in forum: Javascript
    Replies:
    11
    Views:
    385
    Matt Kruse
    Nov 9, 2006
Loading...

Share This Page