A typical SoapClient class looks like
this:
public class MyClient :
SoapClient{
public MyClient(EndpointReference ref)
: base(ref) { }
public SoapEnvelope
MyMethod(SoapEnvelope envelope){
return base.SendRequestResponse("MyServerMethod",envelope);
}
}
The problem of this approach is that it gives you a
flexibility of specifying endpointreference but not the SoapAction. Your client
could have been talking to many web services and I felt it would have been good
to have one client, so I wrote ....
public class MyGenericClient :
SoapClient{
private string soapAction;
public MyClient(string
soapAction,EndpointReference ref) : base(ref) {
this. soapAction =
soapAction;
}
public SoapEnvelope
InvokeService(SoapEnvelope envelope){
return base.SendRequestResponse( soapAction,envelope);
}
}
Pretty easy huh......what I figured out looking
into WSE was that if you specify SoapMethod attribute then the value of
attribute is considered to be a SoapAction and if you do not then WSE takes the
first parameter of SendRequestResponse and put that as the
SoapAction.