_TAD_
asked on
MSXML variant - Create XML Web request without MSXML
I have the MSXML object and I have the following code (which works superbly - local intranet app):
Dim objHTTP As New MSXML.XMLHTTPRequest
Dim strURL As String
Dim strReturn As String
strURL = "http://<server>/<path>/<AppPorta l>.jsp"
objHTTP.open("post", strURL, False)
objHTTP.setRequestHeader(" Content-Ty pe", "text/xml")
objHTTP.send(strXML)
strReturn = objHTTP.responseText
Me.TextBox1.Text = intCtr & ": " & strReturn
Me.Refresh()
Other than converting it to C# (which is trivial), is there any way that I can perform this action using native .net code/libraries?
The MSXML class object is from the MS-XML ToolKit provided by Microsoft.
Dim objHTTP As New MSXML.XMLHTTPRequest
Dim strURL As String
Dim strReturn As String
strURL = "http://<server>/<path>/<AppPorta
objHTTP.open("post", strURL, False)
objHTTP.setRequestHeader("
objHTTP.send(strXML)
strReturn = objHTTP.responseText
Me.TextBox1.Text = intCtr & ": " & strReturn
Me.Refresh()
Other than converting it to C# (which is trivial), is there any way that I can perform this action using native .net code/libraries?
The MSXML class object is from the MS-XML ToolKit provided by Microsoft.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the grade A and glad you have it sussed
ASKER
yes, that's exactly what I needed (with a few minor tweaks).
{my code}
byte[] buff = System.Text.Encoding.ASCII
HttpWebRequest myHttpRequest = (HttpWebRequest)HttpWebReq
myHttpRequest.Method = "POST";
myHttpRequest.KeepAlive = false;
myHttpRequest.ContentType = "application/x-www-form-ur
myHttpRequest.ContentLengt
myHttpRequest.Timeout = 30000;
HttpWebResponse myHttpResponse = null;
string response = string.Empty;
Stream myRequestStream = null;
Stream baseStream = null;
try
{
myRequestStream = myHttpRequest.GetRequestSt
myRequestStream.Write(buff
myHttpResponse = (HttpWebResponse)myHttpReq
baseStream = myHttpResponse.GetResponse
XmlTextReader xmlRdr = new XmlTextReader(baseStream);
xmlRdr.MoveToContent();
response = HttpUtility.HtmlDecode(xml
}