Web page code that works:
Imports System.IO
Imports System.Xml
Imports System.Xml.Schema
Imports System.Net.CredentialCache
Imports System.Text
Imports System.net
Public Class Class1
Private Sub SendDoc(ByRef sData As String)
Const k_send_to_url As String
= "
http://localhost/Reader/Receive.aspx"
Dim request_obj As HttpWebRequest
Dim request_stream As Stream
Dim response_obj As HttpWebResponse
Dim xml_reader As XmlTextReader
Dim docobj As New XmlDocument
Try
request_obj = CType(WebRequest.Create
(k_send_to_url), HttpWebRequest)
request_obj.Method = "POST"
request_obj.ContentType = "text/xml"
request_obj.Timeout = 999999999
request_obj.AllowWriteStreamBuffering = True
request_stream = request_obj.GetRequestStream
()
docobj.LoadXml(sData)
docobj.Save(request_stream)
request_stream.Close()
docobj = Nothing
response_obj = request_obj.GetResponse()
xml_reader = New XmlTextReader
(response_obj.GetResponseStream())
docobj = New XmlDocument
docobj.Load(xml_reader)
request_obj = Nothing
request_stream = Nothing
response_obj = Nothing
Catch ex As Exception
Exit Sub
End Try
End Sub
End Class
Windows code that doesn't:
Imports System.IO
Imports System.Xml
Imports System.Xml.Schema
Imports System.Net.CredentialCache
Imports System.Text
Imports System.net
Public Class Class1
Private Sub SendDoc(ByRef sData As String)
Const k_send_to_url As String
= "
http://localhost/Reader/Receive.aspx"
Dim request_obj As HttpWebRequest
Dim request_stream As Stream
Dim response_obj As HttpWebResponse
Dim xml_reader As XmlTextReader
Dim docobj As New XmlDocument
Try
request_obj = CType(WebRequest.Create
(k_send_to_url), HttpWebRequest)
request_obj.Method = "POST"
request_obj.ContentType = "text/xml"
request_obj.Timeout = 999999999
request_obj.AllowWriteStreamBuffering = True
request_stream = request_obj.GetRequestStream
()
docobj.LoadXml(sData)
docobj.Save(request_stream)
request_stream.Close()
docobj = Nothing
response_obj = request_obj.GetResponse()
xml_reader = New XmlTextReader
(response_obj.GetResponseStream())
docobj = New XmlDocument
docobj.Load(xml_reader)
request_obj = Nothing
request_stream = Nothing
response_obj = Nothing
Catch ex As Exception
Exit Sub
End Try
End Sub
End Class