MSXML problems keeps returning 400 when POST

Discussion in 'ASP General' started by Jason Burr, Jan 13, 2004.

  1. Jason Burr

    Jason Burr Guest

    I keep getting a server error 400 - Bad Request with the code below.

    xmlDoc is the MSXML.DOMDocument populated with the xml data to submit. That
    data is well formed and works fine if I urlencode it and send it via a GET
    instead of POST. It also prints out nice if I simply send it out so I know
    thats not the issue. No matter what I put in there or if I add the data from
    the document into a querystring nothing works. I am assuming that it is my
    web server that doesn't like something but can't for the life of me figure
    out what.

    What I have tried to change

    1. alter the url to include querystring data and simply call send with no
    content
    2. removing the ? from the url
    3. adding the xml content header to the string being sent
    4. changing the setRequestHeader to "application/x-www-form-urlencoded"
    5. submiting nothing to see if the remote server will at least return an
    error
    6. using xmlDoc.xml to place content in send

    I am ready to pull my hair out here I have not had a single "POST" work only
    the "GET" method. (actually that seems now to have discontinued working)

    strURL = "http://testing.shippingapis.com/ShippingAPItest.dll?"

    Set xmlServer = Server.CreateObject("MSXML2.ServerXMLHTTP")
    xmlServer.Open "POST", strURL, False
    xmlServer.setRequestHeader "content-type", "text/xml"
    xmlServer.Send(xmlDoc)
     
    Jason Burr, Jan 13, 2004
    #1
    1. Advertising

  2. Jason Burr

    Mark Schupp Guest

    Are you sure that the DLL is expecting a POST rather than a GET?

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "Jason Burr" <> wrote in message
    news:KGJMb.12317$...
    > I keep getting a server error 400 - Bad Request with the code below.
    >
    > xmlDoc is the MSXML.DOMDocument populated with the xml data to submit.

    That
    > data is well formed and works fine if I urlencode it and send it via a GET
    > instead of POST. It also prints out nice if I simply send it out so I know
    > thats not the issue. No matter what I put in there or if I add the data

    from
    > the document into a querystring nothing works. I am assuming that it is my
    > web server that doesn't like something but can't for the life of me figure
    > out what.
    >
    > What I have tried to change
    >
    > 1. alter the url to include querystring data and simply call send with no
    > content
    > 2. removing the ? from the url
    > 3. adding the xml content header to the string being sent
    > 4. changing the setRequestHeader to "application/x-www-form-urlencoded"
    > 5. submiting nothing to see if the remote server will at least return an
    > error
    > 6. using xmlDoc.xml to place content in send
    >
    > I am ready to pull my hair out here I have not had a single "POST" work

    only
    > the "GET" method. (actually that seems now to have discontinued working)
    >
    > strURL = "http://testing.shippingapis.com/ShippingAPItest.dll?"
    >
    > Set xmlServer = Server.CreateObject("MSXML2.ServerXMLHTTP")
    > xmlServer.Open "POST", strURL, False
    > xmlServer.setRequestHeader "content-type", "text/xml"
    > xmlServer.Send(xmlDoc)
    >
    >
    >
     
    Mark Schupp, Jan 13, 2004
    #2
    1. Advertising

  3. Jason Burr

    Jason Burr Guest

    Yes it actually accepts either. I did get it worked out the post doesnt
    actually accept an xml post but a urlencoded post of the xml data.

    Rather than the xmlServer.Send(xmlDoc) its
    xmlServer.Send(strThatsBeenURLEncoded)

    The 400 error is actually the data that was returned from thier server. That
    was a pain to figure out. Had to point the url to another site and see that
    it was redirected on that site.

    Thanks for your response.


    "Mark Schupp" <> wrote in message
    news:...
    > Are you sure that the DLL is expecting a POST rather than a GET?
    >
    > --
    > Mark Schupp
    > Head of Development
    > Integrity eLearning
    > www.ielearning.com
    >
    >
    > "Jason Burr" <> wrote in message
    > news:KGJMb.12317$...
    > > I keep getting a server error 400 - Bad Request with the code below.
    > >
    > > xmlDoc is the MSXML.DOMDocument populated with the xml data to submit.

    > That
    > > data is well formed and works fine if I urlencode it and send it via a

    GET
    > > instead of POST. It also prints out nice if I simply send it out so I

    know
    > > thats not the issue. No matter what I put in there or if I add the data

    > from
    > > the document into a querystring nothing works. I am assuming that it is

    my
    > > web server that doesn't like something but can't for the life of me

    figure
    > > out what.
    > >
    > > What I have tried to change
    > >
    > > 1. alter the url to include querystring data and simply call send with

    no
    > > content
    > > 2. removing the ? from the url
    > > 3. adding the xml content header to the string being sent
    > > 4. changing the setRequestHeader to "application/x-www-form-urlencoded"
    > > 5. submiting nothing to see if the remote server will at least return an
    > > error
    > > 6. using xmlDoc.xml to place content in send
    > >
    > > I am ready to pull my hair out here I have not had a single "POST" work

    > only
    > > the "GET" method. (actually that seems now to have discontinued working)
    > >
    > > strURL = "http://testing.shippingapis.com/ShippingAPItest.dll?"
    > >
    > > Set xmlServer = Server.CreateObject("MSXML2.ServerXMLHTTP")
    > > xmlServer.Open "POST", strURL, False
    > > xmlServer.setRequestHeader "content-type", "text/xml"
    > > xmlServer.Send(xmlDoc)
    > >
    > >
    > >

    >
    >
     
    Jason Burr, Jan 13, 2004
    #3
    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. Dan C Douglas
    Replies:
    5
    Views:
    407
    Dan C Douglas
    Jul 22, 2003
  2. saha
    Replies:
    0
    Views:
    4,068
  3. OKI
    Replies:
    1
    Views:
    623
    Martin SChukrazy
    Feb 27, 2004
  4. dave

    Authentication Keeps returning to Login Page

    dave, Nov 10, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    105
  5. otto
    Replies:
    0
    Views:
    277
Loading...

Share This Page