Today I have worked on calling web service from console application, and I have searched on google also, but it seems to be not much.
I have done with the following code to call web service.
Imports System.Net Imports System.IO Imports System.Text Public Class ScheduleTrigger Public Shared Sub Main() Const Template As String = _ "<?xml version=""1.0"" encoding=""utf-8""?>" & vbCrLf & _ "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & vbCrLf & _ " <soap:Body>" & vbCrLf & _ " <RunResponse xmlns=""http://tempuri.org/"" />" & vbCrLf & _ " </soap:Body>" & vbCrLf & _ "</soap:Envelope>" Dim url = New Uri("http://localhost/Schedule.asmx") Dim request As HttpWebRequest = WebRequest.Create(url) request.Method = "POST" request.ContentType = "text/xml; charset=utf-8" request.Headers.Add("SOAPAction", "http://tempuri.org/Run") Using stream = New MemoryStream() Using writer = New StreamWriter(stream, Encoding.UTF8) writer.Write(Template) End Using Dim bytes As Byte() = stream.ToArray() request.ContentLength = bytes.Length Using output = request.GetRequestStream() output.Write(bytes, 0, bytes.Length) End Using End Using Using response As HttpWebResponse = request.GetResponse() If response.StatusCode = HttpStatusCode.OK Then Console.Write("Success ") Console.WriteLine("Please Press Any Key to Exit!") Console.Read() End If End Using End Sub End Class