title: How to call a web service using HttpWebRequest
body: <p>I am able to successfully retrieve the wsdl from a server with the code below.</p>
  
  <p>How can I now call a method (GetVersion) from this same service? </p>
  
  <p>Trying <a href="http://www.servername.com/DataService.asmx/GetVersion" rel="nofollow noreferrer">http://www.servername.com/DataService.asmx/GetVersion</a> returns an error saying the page cannot be found. I have no problem calling the method from a .NET WebService reference, but I'd like to be able to use an <code>HttpWebRequest</code>.</p>
  
  <pre><code>Dim req As HttpWebRequest
  Dim resp As HttpWebResponse
  Dim sr As IO.StreamReader
  
  req = WebRequest.Create("http://www.servername.com/DataService.asmx?wsdl")
  resp = req.GetResponse
  
  sr = New IO.StreamReader(resp.GetResponseStream)
  txt.Text = sr.ReadToEnd
  sr.Close()
  </code></pre>