locked
My SOAP extension runs twice RRS feed

  • Question

  • I have a SOAP extension that runs on my web service to process a custom SOAP header.  In my SoapExtension.ProcessMessage override I do something useful in the AfterDeserialize case.  My problem is that my AfterDeserialize code is getting called twice per web service call.  That is, ProcessMessage is getting called twice with message.Stage equal to SoapMessageStage.AfterDeserialize.  (For that matter, it's also getting called twice with stage = BeforeDeserialize, but I don't care about that case.)  I set breakpoints just to make sure I wasn't seeing things.

    It seems like I must be declaring the extension more than once, but the Web.Config for my service contains this section, just once:

    <system.web>
          <webServices>
              <soapExtensionTypes>
                  <add type="FXPAL.USE.Soap.AuthenticationExtension,SoapAuthentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c4749a7c98ea1648, Custom=null"
                     priority="1" group="0" />
              </soapExtensionTypes>
          </webServices>
       . . .
    </system.web>

    Any ideas what's going on, or how I could debug why this is happening?  Or is there something I don't understand about SOAP extensions?
    Wednesday, February 6, 2008 11:24 PM

Answers

  • I'm going to move this question over to the ASMX forum, since it's about ASMX web services.

     

    That said, do you also have a SoapExtensionAttribute? SoapExtensions have two ways to plug themselves in -- you can do it in code via an attribute, or declaratively via configuration. If you do both then I think you'll get two instances and your extension will run twice.

     

    Thursday, February 7, 2008 12:38 AM
    Moderator

All replies

  • I'm going to move this question over to the ASMX forum, since it's about ASMX web services.

     

    That said, do you also have a SoapExtensionAttribute? SoapExtensions have two ways to plug themselves in -- you can do it in code via an attribute, or declaratively via configuration. If you do both then I think you'll get two instances and your extension will run twice.

     

    Thursday, February 7, 2008 12:38 AM
    Moderator
  • Your extension may be getting called once because it's in the config file, and once because of an attribute. Check the two calls to GetInitializer.

     

     

    Thursday, February 7, 2008 6:43 PM
    Moderator
  • That's exactly it -- I have a SoapExtensionAttribute, and somehow overlooked that merely using the attribute would wire it up for me.  Thanks!
    Thursday, February 7, 2008 10:54 PM
  •  

    Friday, February 8, 2008 12:28 AM
    Moderator