Using SoapExtensionAttributes on client side with async web methods

Posted by Maxim Polishchuk on Stack Overflow See other posts from Stack Overflow or by Maxim Polishchuk
Published on 2010-05-06T15:24:18Z Indexed on 2010/05/06 15:28 UTC
Read the original article Hit count: 411

Filed under:
|
|

Hey,

I have a simple question. I implemented custom soap extension and registered it into client application configuration file. It works fine.

(I would like to implement progress bar functionality like http://msdn.microsoft.com/en-us/library/aa480520.aspx)

But I don't like some thing - custom soap extension is invoked by every call of my web service. In order to fix this situation (call WS just by required methods) I implemented custom SoapExtensionAttribute like below:

[AttributeUsage(AttributeTargets.Method)]
public class CustomSoapExtensionAttribute : SoapExtensionAttribute
{
    public override int Priority { get; set; }

    public CustomSoapExtensionAttribute() : this (1)
    {
    }

    public CustomSoapExtensionAttribute(int priority)
    {
        Priority = priority;
    }

    public override Type ExtensionType
    {
        get { return typeof(CustomSoapExtension); }
    }
}

I added this attribute to required methods of web service proxy classes (and removed registration into client configuration file).

My soap extension doesn't invoke when required web methods are calling.

Can someone help me to solve this problem or select any other solution? Anotherone, I don't know it is important or not - my required methods are async web methods.

Best regards, Maxim

© Stack Overflow or respective owner

Related posts about c#

Related posts about webservice