.netweb-serviceswcfsoacontract-first

Contract First SOA and WCF Contracts


I have a simple question. I am using WCF to create web services. I have created all the services without filling the operation bodies. Now I have the wsdl files auto-generated from the service contracts. Is this approach "Contract First", if I am coding the operation implementations later?


Solution

  • Yes, because you're defining the contract between you and anyone consuming your API first. Usually (but not always) the contract/API is defined via an interface.

    Edit: As Namphibian said in the comments, if you're building web services contract first, then you would want to define your WSDL first and generate the code from there. My answer assumed you wanted to develop a .NET API contract first and that you were going to expose it as a web service after the fact.

    Second edit: I wanted to add that SOA principles themselves have nothing to do with web services. You can build services that are only exposed via their codified API.