Subject: activating a SOAP extension from a client
Posted By: Robert Rotstein Post Date: 1/10/2006 10:18:38 AM
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.SoapExtensionAttribute
           {
               ...
               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?


Go to topic 38517

Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393
Return to index page 392
Return to index page 391
Return to index page 390