Imports System.IO Imports System.Xml Imports System.Net Public Class MainClass Shared Sub Main() Dim url As String = "http://122.166.7.149/meaweb/services/PMOASSETINTQRY" Dim req As WebRequest = WebRequest.Create(url) req.Credentials = CredentialCache.DefaultCredentials req.Method = "POST" req.ContentType = "text/xml" 'req.Headers.Add("MI_XMLPROTOCOLREQUEST", "MatrixRouteRequest") 'req.Headers.Add("MI_XMLPROTOCOLVERSION", "3.2") Dim writer As New StreamWriter(req.GetRequestStream()) Dim reader As New StreamReader("C:\test.xml") writer.Write(reader.ReadToEnd()) Console.WriteLine("Posted to remote server") writer.Close() reader.Close() Dim response As WebResponse = req.GetResponse() Dim responseXML As New XmlDocument responseXML.Load(response.GetResponseStream()) Dim twriter As New XmlTextWriter("c:\myresponseVB23.xml", System.Text.Encoding.UTF8) responseXML.WriteTo(twriter) twriter.Flush() twriter.Close() response.GetResponseStream().Close() req.GetRequestStream().Close() End Sub ' Main End Class
<system.web><trust level="Full" /> ...</system.web>
try..catch
System.Exception
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)