Suppose I have an asmx web service at the following address: http://localhost/BudgetWeb/Service.asmx
This web service has a web method with the following signature:
string GetValue(string key)
This GetValue method returns a string like this:
<?xml version=\"1.0\" encoding=\"utf-8\" ?><value>250.00</value>
What if I wanted to do this:
XDocument doc = XDocument.Load("http://localhost/BudgetWeb/Service.asmx?op=GetValue&key=key1")
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 string GetValue(string key)
, and then I could use that value returned from the web proxy class to pass to the XDocument.Load method.
Is my understanding correct, or is there a way for XDocument.Load to actually invoke a web method on the server?