Search code examples
wcfasmxwcf-routing

Routing calls to legacy ASMX web service through WCF Routing Service


I am working on a legacy application that contains references to two .asmx web services. We want to restructure the service layer to follow more of an Enterprise Service Bus pattern, where the client will direct all of its calls to one service, which handles the routing of the requests to the appropriate services.

I have been working with the WCF Routing Service and have been able to successfully route a call to a WCF service through the RoutingService and on to the appropriate service.

For example, the client can make a call to:

http://routingservice/RoutingService.svc/WcfService

and the routing service will forward it along to

http://wcfservice/WcfService

through the rules that I specify in configuration

I would like to somehow achieve the same result with the .asmx services to that I can just update the web reference URL in the legacy application to point to the routing service, which will then forward the requests on the to the URL that the client is currently using

Change:

http://webservices/LegacyService.asmx

to

http://routingservice/RoutingService.svc/LegacyWebService

Is this possible to do in the manner that I am thinking of?


Solution

  • I have never tried it but theoretically it should work without any problem. WCF is backward compatible to ASMX - you can use WCF client to talk to ASMX and WCF can be used instead of ASMX with some additional configuration if it needs to access ASP.NET pipeline. Just try to use routing endpoint with basicHttpBinding (that is used for backward compatibility). For the routing service use IRequestReplyRouter contract.

    There can be one problem - if your ASMX services are using ASP.NET session the session key is transferred in cookie - I'm not sure how routing service deals with cookies.