Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Is it possible to attach any SoapExtension to async web services method in .NET. I've tried for normal Invoke method and it worked but I'm unable to get it work with InvokeAsync.
C#
[soapExtensionAttribute]
       [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://xxx.yyy.zzz.com/WebServiceMethod", RequestNamespace = "http://xxx.yyy.zzz.com", ResponseNamespace = "http://xxx.yyy.zzz.com/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

 public void CallItAsync(string params, object userState)
 {
     if ((this.OperationCompleted == null))
     {
         this.OperationCompleted= new System.Threading.SendOrPostCallback(this.OnOperationCompleted);
     }
     this.InvokeAsync("NameOfMethod", new object[] {
                 params}, this.OperationCompleted, userState);
 }
   [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://xxx.yyy.zzz.com/WebServiceMethod", RequestNamespace = "http://xxx.yyy.zzz.com", ResponseNamespace = "http://xxx.yyy.zzz.com/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

    [soapExtensionAttribute]
   public string JustiCallIt(string params)
   {
       object[] results = this.Invoke("NameOfMethod", new object[] {
                 params});
       return ((string)(results[0]));
   }

The second and non-async method call extension but first and async never.Thanks in any advice.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900