Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting ASMX to WCF Web Service

Tags:

wcf

I need to upgrade our web services to use WCF instead of ASMX. If the signatures of the web services stays the same, will existing clients that already call the ASMX service have to change anything on their end? Is there anyway to still use WCF but not force them to change anything?

like image 530
user31673 Avatar asked Jun 23 '09 03:06

user31673


2 Answers

Option 1 :

  1. Using the current ASMX's WSDL, generate the client using svcutil.exe

  2. Grab the generated interface and create a WCF service based on this interface

    Output : One new WCF endpoint configured with basicHttpBinding. Clients need to update the URL at which they're sending the messages.

Option 2 :

  1. Refactor your ASMX code. Move all the logic into a separate DLL.

  2. Create a WCF service and use the logic in the refactored DLL.

    Output : 2 endpoints, one for ASMX and another one for WCF

like image 77
user20155 Avatar answered Nov 04 '22 12:11

user20155


If you use the BasicHttpBinding for your new WCF service, and implement the same methods with the same message structure, existing callers should be able to call into this new WCF service without any change on their part.

There's also an AspNetCompatibilityRequirements attribute in order to get around some potential compatibility issue - see the MSDN documentation on it.

Marc

like image 22
marc_s Avatar answered Nov 04 '22 11:11

marc_s