Bill Gibson's Blog

Thoughts on building SQL Server Data Tools

Does Application Designer support operations defined on interfaces?

Another question that keeps cropping up is whether we support viewing and editing Web service operations when these are defined on interfaces.  It usually comes up in the form of the question, I’ve built a Web service and defined the operations using attributes on methods on an interface, but the operations don’t show up in the Web Service Details window when I click on the endpoint.  What’s wrong? 

Application designer doesn’t support display of the operations where the WebMethod attributes are defined on methods on an interface.  The Web method attributes must be placed on the concrete class referenced by the asmx file for them to appear as operations in the Web Service Details window.  The endpoint does appear on the diagram and you can navigate from it to the class in code, but we don’t walk up the inheritance chain to look for attributes on the interface, so we don’t see the operations.  Asmx platform support for interfaces was only introduced into the VS 2005 release late in cycle, too late for us to respond with effective tool support.  We would have needed to support both viewing and editing operations and handle several complex use cases around mixed definitions.  It simply wasn’t possible to address this in the time available and ensure the quality level we wanted so we had to cut the feature.

We recognize the value of using interfaces which are a cornerstone of the Windows Communication Foundation (Indigo) service model.  So, expect to see tool support for WCF fully incorporate interface support as part of a contract-driven service development approach.  We’ll be able to talk more about this as our plans crystallize.

And on this topic, one observation is that if using a contract-driven approach in which a WSDL contract is viewed as the master, then it is not so critical that a CLR interface exists.  Using the Application Designer’s support for creating web service endpoints from WSDL you can construct the web service implementation class from the WSDL contract directly.  While using interfaces undoubtedly helps some aspects of the engineering process it is not as critical when a WSDL doc is considered the master definition.  And note also that you can use interfaces in your design it is just that the Web service-related attributes must be defined on the concrete class for Appplication Designer to recognize them, and any edits in the designer are applied to the methods on the class and not the interface.