activating a SOAP extension from a client
I want to write a SOAP extension that gets activated from both the client and the server. But so far, I have only been able to activate from the server.
I have a service (.asmx file) which contains the following:
namespace OfficerCallIn
{
[WebService(Name="OfficerCallInService",Namespace=" TheOfficerCallInService")]
public class OfficerCallInService : System.Web.Services.WebService {
. . .
[WebServiceHeaderExtension.CryptoSOAPExtAttribute]
[WebMethod(EnableSession=true)]
public void ProcessOfficerLocationAndStatus { ... }
}
}
The SOAP extension file looks like this:
namespace WebServiceHeaderExtension
{
[AttributeUsage(AttributeTargets.Method)]
public class CryptoSOAPExtAttribute :
System.Web.Services.Protocols.SoapExtensionAttribu te
{
...
public override Type ExtensionType
{get {return typeof(CryptoSOAPExt); }}
}
public class CryptoSOAPExt :
System.Web.Services.Protocols.SoapExtension
{
... // the usual methods
}
}
and the client call looks like this:
OfficerCallInService srvc = new OfficerCallInService();
srvc.ProcessOfficerLocationAndStatus( . . .);
The intention is to put some encryption/decryption code, currently residing in the client, into the SOAP extension. Right now, the extension methods are essentially empty, containing nothing more than the usual boilerplate code and a few MessageBox() pop-ups to signal that they are being activated.
I can see that the service is activating the SOAP code, since the pattern of activations is: BeforeDeserialize, AfterDeserialize, BeforeSerialize, AfterSerialize. This is the standard server-side pattern. But what must I do to get the client to activate the SOAP extensions? I'm sure that I am overlooking something perfectly simple and obvious, but, as I am a beginner at this material, I don't know what it is. Can someone clue me in?
|