title: is there anyway to have dynamic web service reference?
body: <p>my goal is to connect to a sharepoint list and download the data into a datatable.  I can do this fine but one in a very "hardcoded" way because i have to manually, inside visual studio, on a project add a web reference.  For example, if i want to point to something like this: </p>
  
  <p><a href="http://www.ab.com/sites/SiteCollections/MyTeam/_vti_bin/dspsts.asmx" rel="nofollow">http://www.ab.com/sites/SiteCollections/MyTeam/_vti_bin/dspsts.asmx</a><br>
  or<br>
  <a href="http://www.abc.com/sites/MyTeam/_vti_bin/Lists.asmx" rel="nofollow">http://www.abc.com/sites/MyTeam/_vti_bin/Lists.asmx</a></p>
  
  <p>(just a dummy URL to show the format).</p>
  
  <p>I have to create a web service reference in Visual studio. This generates a bunch of code (Reference.cs) and creates a web reference section in my project and in app.config and i can now use this code:</p>
  
  <pre><code>  com.mysite.Lists lists = new Lists();
    lists.Credentials = new System.Net.NetworkCredential(user, pwd, "CORP");
    lists.Url = "http://www.abc.com/sites/MyTeam/_vti_bin/Lists.asmx";
  
    XmlNode ndQuery = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "");
    XmlNode ndViewFields = xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields", "");
    XmlNode ndQueryOptions = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");
  
    XmlNode listitems = lists.GetListItems(sharepointList, null, ndQuery, ndViewFields, "1000",
                                                 ndQueryOptions, null);
  </code></pre>
  
  <p>is there anyway i can just take a URL externally and have this code work without having to create all of these manually updates and config updates.</p>
  
  <p>I want to make this code into a library so people can just take a URL and pass it in.  The funny thing is that if you look above their is a URL property (so you think it would work) but it doesn't seem to work unless all of the other config and references are setup.  Is there anyway to do this without needing all of this visual studio autogenerated config driven code at all?</p>