Anyone know ASP?

Very off topic, but I know we have some very experienced guys here…and like asking for directions or going to the Doctors, this is something I have put off asking for help with for a while.

I’m dabbling in web services and I have a particular use in mind.
That use sends POSTs to a target URL, but the body of the POST is an XML structure.

I’m new to ASP , and I realise things have moved on.
But I understand VBscript and if I can get something working with that to understand the concepts, I can then consider moving to something newer.

Everything I can find on the subject of receiving a Request suggests that there are two kinds of data:
Query String (a commandline style way of sending data, using pairs like JSON does it)
FORM data.

Now the body contains an XML structure, not form data, and I have spent a week failing to get that XML string out of the POST and into a string variable, or into an XMLDOC
I’d show you my code but Ive tried dozens of permutations and dont know which one was even close.

The most recent attempt looks like this but just errors:

Set Dom = CreateObject("Microsoft.XMLDOM") dim xmlData xmlData = Request.Form["xml"] dom.LoadXml(xmlData)

This is how I am calling my test asp page. (It seems OK when I send the POST to someone else’s real server by the way)

[code]Set xmlhttp = WScript.CreateObject(“Microsoft.XMLHttp”)
Dim s
s = “<?xml version='1.0'?>”
s = s+ “”
s = s+ “aaaaaaaaaaaaaaaaaaaa
s = s+ “”
s = s+ “”

xmlhttp.open “POST”, “http://127.0.0.1/receiver/receive.asp” , False
xmlhttp.setRequestHeader “Content-Type”, “text/xml”
WScript.Echo "Sending request to the server… "
xmlhttp.send s

Wscript.echo "Response = " & xmlhttp.responseText[/code]

Maybe ASP is too old to expect an XML payload?

But has anyone done this before and can help me out before I consider self-mutilation?

( I realise that things have moved on, but for the moment, I want to start simple , using VBScript which I like, as opposed to a crash course in Visual Studio which I havent seen since 2003)

You really want to try Xojo Web…

Ultimately what I need to do is produce an ASP page which can serve as a simple example of how other people can process these messages. If I get that working I can explain it and help people.
Moving on from that perhaps to aspx .

Most of those other people won’t want to use or learn how to write a Xojo Web app, with its attendant costs and deployment issues.

Well it is a very long time ago, but I doubt very much that your POST is set up correctly, although I can’t really say why exactly it smells to me. If I remember correctly form data ends up as some kind of keyed pair, so the key ‘xml’ should some how map to the contents of your variable s, but I don’t see that happening in your POST script. It is a long time ago so I could be wrong.

If I do recall a bit, ASP POSTs usually pass content using “multipart/form-data” encode type, that fills the object Request.Form with it in the receiver page. As you are passing in a raw format, you need to intercept the content using tricks to read the raw contents, but I don’t recall how (But yes, I know that we can do it, because I did it more than 15 years ago using ASP).

Do tests using this:

<%
dim myData
myData=Request.BinaryRead(Request.TotalBytes)
%>

Yap, on the money! @Jeff, the other way around it would be to rewrite your POST script to correctly send the data the correct “multipart/form-data” as mentioned by Rick.