Hi,
I would like to know like How do I load the XML Response which I got from
HttpWebResponse?
What I am doing, I will just put for your perusal;
Dim hwrRequest As HttpWebRequest =
CType(HttpWebRequest.Create("https://someurl"), HttpWebRequest)
hwrRequest.Method = "POST"
hwrRequest.ContentType = "text/xml"
Dim encoding As UTF8Encoding = New UTF8Encoding
Dim postBytes() As Byte = encoding.GetBytes(strReq)
hwrRequest.ContentLength = postBytes.Length
Dim postStream As Stream = hwrRequest.GetRequestStream()
postStream.Write(postBytes, 0, postBytes.Length)
postStream.Close()
Dim hwrResponse As HttpWebResponse = CType(hwrRequest.GetResponse(),
HttpWebResponse)
Dim responseStream As Stream = hwrResponse.GetResponseStream()
Dim sr As StreamReader = New StreamReader(responseStream)
Dim respString As String = sr.ReadToEnd()
''Me.TextBox1.Text = respString
'' here If I am populating in the Multiline Textbox , I am getting the XML
Response
But What I want is directly consume that XML Response into the DOM
XmlDocument.
I tried passing the StreamReader into the Load Method of XmlDocument, but
it gives me the error.
Dim xDoc As New XmlDocument
xDoc.PreserveWhitespace = True
xDoc.Load(respString)
AddText("XML Content", xDoc.OuterXml)
hwrResponse.Close()
Any help would be of great help to me
bye
ss