At some point in your career you will need or want to call a Web Service from either a class library, a server control, HTTPModule, etc... If your lucky, you will soon realize that making a "Web Reference" in these types of projects is; at the very least; problemattic. So what if you could reflect a Web Service and then invoke it as you would with other object types, assemblies, and so forth... Well... You can. Below you will find a link to a commented class that you can use to make late-bound calls to web services given there WSDL Path, Service Name, and Service Type Name (e.g. class name). Once you are familiar with its inner workings it is pretty easy to extend to support custom SOAP Headers, Type Reflection, etc...
samplewsinvoker.htm (32.88 kb)
Once you have the invoker, making a web service call is pretty simple.
Dim wsInvoker As New WebServiceReflectedMethodInvoker(
"http://localhost/service/service.asmx?WSDL", "service", "service")
Dim arguments As New OrderedDictionary
Dim user As Object
'Execute the WS
user = wsInvoker.InvokeWebServiceMethod("GetUser", arguments)
Here is yet another side note... There is a performance hit when you make this type of call as compared to a "Web Reference". However, one benefit is that you do not have to keep a lot of extraneous proxy classes under source control for methods and classes you do not plan on using. Additionally, you will not run into problems related to needed "Update Web Reference" just to keep your solution up to date.