MSXML problems keeps returning 400 when POST

J

Jason Burr

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)
 
J

Jason Burr

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top