V
Vivek Mehta
I want to receive XML stream generated at another URL however when I
try to load the XML it errors out with one error or the other. I
beleive this XML comes back with HTTP header which actually comes back
as part of the response and obviously causes the
xmlDoc.Load(myResponseStream) to break because the test preceding the
XML makes the xml invalid.
How can I remove this content from the receiving XML stream ?? Here is
some sample code :
..NET Page receiving response
sub Page_Load(sender as object, e as Eventargs)
Dim wRequest As System.Net.HttpWebRequest
Dim wResponse As System.Net.HttpWebResponse
Dim StreamHandler As System.IO.StreamReader
Dim xmlDoc As New System.Xml.XmlDocument
Try
Dim URL As String = "http://localhost/aspnet/process.asp"
wRequest = System.Net.WebRequest.Create(URL)
wRequest.Headers.Add("Man", "GET " & URL)
wResponse = CType(wRequest.GetResponse,
System.Net.WebResponse)
If wRequest.HaveResponse Then
if wResponse.StatusCode = Net.HttpStatusCode.OK Then
streamHandler = New
System.IO.StreamReader(wResponse.GetResponseStream())
xmlDoc.LoadXml(StreamHandler.ReadToEnd)
MsgBox("[--------" & xmlDoc.InnerText & "-------]")
End If
End If
'Catch ex As System.Net.WebException
Finally
End Try
end sub
I always get error at xmldoc.loadXML
Here is the Process.asp to which the call is being made above to send
XML stream.
<html><head> <title>process</title></head>
<body>
<form id="Form1" method="post" runat="server">
<script LANGUAGE="VBSCRIPT" runat="server" >
Response.Buffer=True
Response.ContentType = "text/xml"
With Response
.Write("<?xml version='1.0' ?>" & chr(13))
.Write("<Record>")
.Write("<Name>")
.Write("<Last> Jones </Last>")
.Write("<First> Kim </First>")
.Write("</Name>")
.Write("</Record>" )
End With
</script>
</form>
</body>
</html>
I would really appreciate any help on this.
try to load the XML it errors out with one error or the other. I
beleive this XML comes back with HTTP header which actually comes back
as part of the response and obviously causes the
xmlDoc.Load(myResponseStream) to break because the test preceding the
XML makes the xml invalid.
How can I remove this content from the receiving XML stream ?? Here is
some sample code :
..NET Page receiving response
sub Page_Load(sender as object, e as Eventargs)
Dim wRequest As System.Net.HttpWebRequest
Dim wResponse As System.Net.HttpWebResponse
Dim StreamHandler As System.IO.StreamReader
Dim xmlDoc As New System.Xml.XmlDocument
Try
Dim URL As String = "http://localhost/aspnet/process.asp"
wRequest = System.Net.WebRequest.Create(URL)
wRequest.Headers.Add("Man", "GET " & URL)
wResponse = CType(wRequest.GetResponse,
System.Net.WebResponse)
If wRequest.HaveResponse Then
if wResponse.StatusCode = Net.HttpStatusCode.OK Then
streamHandler = New
System.IO.StreamReader(wResponse.GetResponseStream())
xmlDoc.LoadXml(StreamHandler.ReadToEnd)
MsgBox("[--------" & xmlDoc.InnerText & "-------]")
End If
End If
'Catch ex As System.Net.WebException
Finally
End Try
end sub
I always get error at xmldoc.loadXML
Here is the Process.asp to which the call is being made above to send
XML stream.
<html><head> <title>process</title></head>
<body>
<form id="Form1" method="post" runat="server">
<script LANGUAGE="VBSCRIPT" runat="server" >
Response.Buffer=True
Response.ContentType = "text/xml"
With Response
.Write("<?xml version='1.0' ?>" & chr(13))
.Write("<Record>")
.Write("<Name>")
.Write("<Last> Jones </Last>")
.Write("<First> Kim </First>")
.Write("</Name>")
.Write("</Record>" )
End With
</script>
</form>
</body>
</html>
I would really appreciate any help on this.