Add timeout to a webservice response
Posted on 2014-10-08
I have a function in my VB.NET application which consumes a webservice. That webservice is a bit inconsistent and does load. That is, if i go to it's wsdl URL when it is down, it would not load for 2 minutes and then return "Not available".
So in my function I want to give the web service 30 seconds to respond. If it does not then i would like to go to the next step. Can I do that?
Dim webservResponse As String
Dim oXmlResponse As New System.Xml.XmlDocument
'Add timeout for the entire getWebservice function (or) just the line below.
webservResponse = webservice.getinvoicexyz(<username>, <password>, billnumber)