Creating a web reference is just a convenient way to ask Visual Studio to
create a proxy for you. In large apps we typically create our own proxies
that are distributed as assemblies. You can use a VS-generated proxy as a
starting point - just create a web reference, then look at the generated
proxy code.
// namespaces elided
namespace MyApp.WebServiceProxy
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="MyServiceSoap",
Namespace="
http://www.servergeek.com/demos/2004")]
public class MyService: SoapHttpClientProtocol
{
public MyService(string url)
{
this.Url = url;
}
[SoapDocumentMethod("
http://www.servergeek.com/demos/2004",
RequestNamespace="
http://www.servergeek.com/demos/2004",
ResponseNamespace="
http://www.servergeek.com/demos/2004",
Use=SoapBindingUse.Literal,
ParameterStyle=SoapParameterStyle.Wrapped)]
public string Hello(string message)
{
object[] results = this.Invoke("Hello", new object[] {message});
return ((string)(results[0]));
}
}
}