Hi everyone,
I have found out the solution myself and I am replying so if anyone needs it might find it helpful. Basically is to use the WebRequest function provided by System.Net. Here is the VB codes:
Imports System.Net
Imports localhost.Service1
Public Function WebServiceRunning() As Boolean
Try
Dim colProcess As New localhost.Service1
Dim siteUri As New System.Uri(colProcess.Url.ToString)
Dim webRequest As System.Net.WebRequest = System.Net.WebRequest.Create(siteUri)
Dim webResponse As System.Net.WebResponse = webRequest.GetResponse()
If IsNothing(webResponse) Then
WebServiceRunning = False
Else
WebServiceRunning = True
End If
Catch ex As Exception
WebServiceRunning = False
End Try
End Function
End Class
Note: You need to do a web reference to the web service that you are consuming. The Imports localhost.service1 is the web reference that I am consuming. You also might want to set the URL property of the web reference to 'Dynamic' so that if the URL of the web service changes, you only need to update location in the App.Config file of your window application without need to recompile your application.
regards,
Parkyboy