title: How to call a web service using XDocument?
body: <p>Suppose I have an asmx web service at the following address:
  <a href="http://localhost/BudgetWeb/Service.asmx" rel="nofollow noreferrer">http://localhost/BudgetWeb/Service.asmx</a></p>
  
  <p>This web service has a web method with the following signature:</p>
  
  <pre><code>string GetValue(string key)
  </code></pre>
  
  <p>This GetValue method returns a string like this:</p>
  
  <pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\" ?&gt;&lt;value&gt;250.00&lt;/value&gt;
  </code></pre>
  
  <p>What if I wanted to do this:</p>
  
  <pre><code>XDocument doc = XDocument.Load("http://localhost/BudgetWeb/Service.asmx?op=GetValue&amp;key=key1")
  </code></pre>
  
  <p>This doesn't work, and I'm pretty sure that XDocument.Load doesn't actually invoke a web method on the server. I think it expects the uri to point to a file that it can load. To call a web method, I think I'd have to have a web proxy class and would have to use that to call <code>string GetValue(string key)</code>, and then I could use that value returned from the web proxy class to pass to the XDocument.Load method.</p>
  
  <p>Is my understanding correct, or is there a way for XDocument.Load to actually invoke a web method on the server?</p>