Can you please help me to finish converting the .net code below into
vbscript?
My vbs function at the end works when posting to another asp file on the
same win server,
but I need to post the xml to a .jsp file on a unix box. The jsp file just
returns an internal server error. It crashes with a null pointer exception
when trying to read the request. Presumably because it is not in an ascii
byte array?
How do I do those parts?
If it is too complex, then let me know and I will use the .NET code as a
relay. I would just prefer to have it all in one file.
.NET CODE
=========
// create a web request and set the method of the request to POST
HttpWebRequest request = (HttpWebRequest)
HttpWebRequest.Create(requestLocation);
request.Method = "POST";
// encode the data and store the byte representation in an array
ASCIIEncoding encoding = new ASCIIEncoding();
string postdata="xml="+HttpUtility.UrlEncode(xmlDoc);
// string postdata="xml="+xmlDoc; byte[] requestData = encoding.GetBytes(postdata);
// set the content type of the data being posted.
request.ContentType="application/x-www-form-urlencoded";
// set the content length of the string being posted
request.ContentLength = postdata.Length;
// Status.Text += "Submitting activity message";
Stream requestStream = request.GetRequestStream();
requestStream.Write(requestData,0,requestData.Length);
// flush out the data to the underlying stream and close it
requestStream.Flush();
requestStream.Close();
// retrieve the response from the web server
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
StreamReader responseData = new
StreamReader(response.GetResponseStream());
err+= responseData.ReadToEnd();
MY VBS CODE
===========
Function iXMLPostSTX(STX_URL, POXMLData, ByRef XMLResp)
Dim oHttp
Set oHttp = Server.CreateObject ("MSXML2.ServerXMLHTTP")
Dim status
oHttp.open "POST", STX_URL
oHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oHttp.setRequestHeader "Connection", "Keep-Alive"
oHttp.send POXMLData
status = oHttp.statusText
iLog("Status=" & status)
XMLResp = oHttp.responseText
End Function