Part of the fun of being a consultant is that the technology you use changes from day to day.  Recently it is WCF which, while knowing the concepts of since it came out I haven’t used up until now.

The nice thing is that it really isn’t any harder to develop for than a normal ASP.NET web service.  A couple of the attributes change and which project type you start with is different, but it is still message based services.

Just like the method of a web service needs a Webmethod attribute a method in a WCF service requires a OperationContract attribute.  The main difference is that you start by defining your operations in an interface.  Once you have an interface like the extract below you simply create an implementation class based on the interface.

public interface IMyServices
MyCustomReturn GetMyData(MyDataRequest dataRequest);

To get your WSDL and its associated XSD to generate in a way that is intelligible by other developers you need to effectively use the DataContract and DataMember attributes.  The resulting class will look similar to the extract below.

public class MyCustomReturn
public string UserEmail;
public string BusinessUnitId;
public ClientAddressInfo ClientAddressInformation;

Once you have this base the rest of the development is straight up .NET.  The other thing you need to know is how to get at your WSDL and XSD.  The WSDL is the easy part.  Add “?wsdl” to the URL for your .svc file.

Finding the XSD isn’t that difficult.  If you look in the WSDL definition there is a tag for <wsdl:types>.  Within this tag you will find an <xsd:imports> that ties back to your service’s namespace.  Normally this is just adding a query string of “?xsd=xsd2” to your service URL.

Lastly you need to learn how to use the WCF Test Client.  The one way I have found to launch it is to make sure your service code file is active in the Visual Studio editor and hit F5.


This tool will allow you to do most of you basic testing of the service you just built.