2

I am migrating a .NET GUI application built in .NET 1.1 to .NET 4.0. The application uses WSE 2.0 for web service communication. Web Service Comm. Module contains web service proxy and other class files implementing asynchronous functioning. The module sits between .NET GUI application and application Server hosting Web Services. Application Server has been implemented in non-Microsoft technology and the migration project should not change the server and the web services.

All the classes and forms in .NET GUI application call synchronous methodName of web service proxy class. Web Service Proxy derives from a custom class which in turn derives from Microsoft.Web.Services2.WebServicesClientProtocol. The custom class overrides “Invoke” method. Method “BeginInvoke” is called inside overrided “Invoke” method. Therefore even though application classes and forms are calling synchronous methodName , finally the web request goes as asynchronous. Overrided “Invoke” method and the custom class enable to display dialog window with Cancel button for cancelling web request.

Proxy class in WCF has following implementation for a web method call. Is there something in WCF which can allow to customize functioning of call Base.Channel.MethodName(input)? Basically something which can allow changing synchronous web method call to asynchronous at run time?

[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    getNewCustomerCodeResponse iAccountService.getNewCustomerCode(getNewCustomerCode request)
    {
        return base.Channel.getNewCustomerCode(request);
    }
Graymatter
  • 6,529
  • 2
  • 30
  • 50
Santosh_T
  • 21
  • 1
  • 1
    Note, that the client does not care whether the server is internally async or not. It can always use async (or sync). Completely independent. – usr May 21 '14 at 21:28
  • http://stackoverflow.com/a/22591516/122718 – usr May 21 '14 at 21:44
  • There is no problem with asynchronous call to server. Server responds correctly to Begin XXXX and END XXXX methods. We don’t want to split proxy class into Begin XXXX and END XXXX methods which would result lot many changes in the GUI application. We want to develop asynchronous mechanism similar to existing wherein the GUI application will call synchronous method (method defined in proxy class) and somewhere in WCF programming model the web request will be sent asynchronously to the server. – Santosh_T May 22 '14 at 21:35
  • I get it now. Maybe you can implement a custom channel that wraps a WCF-provided channel and calls the wrapped channel's async methods. – usr May 22 '14 at 21:43
  • I've created class that allows creating async proxy from just sync wcf service contract interface at runtime. Is it that you are looking for? – SalientBrain May 27 '14 at 06:42
  • Thanks usr!! Custom channel solved the problem. I referred to MSDN article -----> http://code.msdn.microsoft.com/Custom-WCF-channel-used-to-0dd3413f – Santosh_T May 30 '14 at 03:33

0 Answers0