I am trying to figure out how to create an architechture for client code to
make calls to a web service but do some common operations in the proxy code
so each client call to the web service does not need to do these things.

Things I would like to do:
1) Set the url from a client config file at runtime
2) Each [WebMethod] takes a standard SOAP header. For each web service call
fill in the header data from the user's session.

I have tried to do this by inheriting from the Proxy classes generated by
"Web Reference" but I have run into problems doing this. Using the sample
code below I would like to derive a single base class that all generated
proxy classes can inherit from that will do these common operation since the
code would be identical for each proxy class.

The code below will work but that means that EVERY web service method needs
me to cut and paste this logic into a new Proxy class. The problem with
creating a base class and changing the generated classes to inherit from is
that the Soap header is defined in each generated proxy class so in a base
class I do not have access to the Soap header class.

Is there a way that I can override a method in
System.Web.Services.Protocols.SoapHttpClientProtoc ol to do these operations?

Ex. [C#]
//The generated proxy class
public class MyWebService : SoapHttpClientProtocol
public MyWebService
this.Url = "http://...";

public int Add(int a, int b)
object[] results = this.Invoke("Login", new object[] {a,b});
return ((int)(results[0]));

//My override class
public class MyWebServiceProxy : MyWebService
public MyWebServiceProxy()
this.Url = Application["ServiceUrl"].Value;

public int Add(int a, int b)
//fill in the soap header
this.MyHeader.Data = Session[""];;
int result base.Add(a,b);