Clemens and I disagree on the importance of angle-brackets

Clemens has a new post titled “Bad Habits to Give Up: Staring at Angle Brackets”. I agree, that is a bad habit to give up... you should keep doing it! :-) Seriously, though, that isn't what he meant.

Clemens perspective is that you should simply use Indigo's native programming model to capture your contract and let WSDL generation happen under the covers for the people who need it. Specifically, he says that:

Sharing this C# snippet here

[ServiceContract]
interface IHello
{
      [OperationContract]
      string SayHello(string name);
}


is a perfectly reasonable way to share contract between server and client, if you’ll be sticking to Indigo. A service can expose all the WS-MetadataExchange and XSD and WSDL you like so that other Web Service clients can bind to your service, but as long as you stay on the System.ServiceModel level and focus on writing a distributed systems solution instead of writing something that “does XML”, you won’t have to worry about all the goo that goes on in the basement.

The key phrase is “if you'll be sticking with Indigo”. While some people may not believe it, I'm a big fan of Indigo and if I could live in an Indigo-only world, I would do exactly what Clemens suggests. But if you work in a company that can't or won't commit itself to a single toolkit (and maybe even a single version of a single toolkit, depending on how versioning works), you probably can't take that path. Most large companies are in that situation. They have lots of different systems built lots of different ways. They may be able to do anything new using Indigo, but they need to integrate with existing systems that use other Web service kits (ASP.NET Web Services, Axis, etc). I find myself in a similar situation today: I'd like to be using my native C#, but my company is building in Java so I have to spend some time there too.

All of this comes back to reach, a topic I've been writing a lot about lately, including this post about “My 3 Web Service Stacks“. Clemens likes the toolkit-specific stack, where you get lots of rich, natural functionality but reach may be limited. If you focus on “writing a distribute system solution instead of writing something that 'does XML' “, you are very likely to do something that constrains your reach. That's okay if reach is not your goal. But if reach is your goal, this approach is likely to hurt you because you'll be leaving the details of the service contract that really matters - that is, WSDL/XSD/Policy - to the plumbing and just counting on it generating the right thing (and hopefully what that means won't change across toolkit versions).

The right thing, of course, is open to interpretation. If your plumbing generates a legal but overly complex schema that is hard for a customer to consume, you aren't making it easy for them to do business with you. Amazon and EBay wouldn't be making money hand over fist if they didn't put some effort into making it so that everyone can easily consume the services they provide. If you focus on your own toolkit and let it handle all the details of the contract for consumers using other toolkits, you run the risk of relegating those consumers to second class status. It's hard to think of a reason why you'd want to do that, other than it's easier for you. If your goal is to facilitate consumption of your service, then you should pay the price, suffer the pain, do whatever you have to to make sure that creating a client for your service is easy.

This is not really a new topic. Lot's of Web service developers would prefer to eschew WSDL's angle brackets in favor of code. When I worked at Microsoft, almost every internal WS spec I saw used C# to spec services, with the implicit assumption that we'd all be using not just ASMX, but a specific version of ASMX (because serialization behavior will change). This approach makes no sense to me. I think that “doing XML“ and thereby gaining reach is the aspect of Web services that makes the cost of reinventing our distributed platform yet again worthwhile. XML is not just an implementation detail, it is the implementation detail that actually makes this Web services thing work. If you don't care about XML and the reach it brings, why move to a new platform at all? Why not stick with one of the myriad of mature, well-known technologies that we already have at our fingertips?

So, all of that said, since Clemens shared explicit guidance on what he thought you should do, I'll do the same. I think you there are two things you have to do with Web services, regardless of toolkit, including Indigo:

1) Remember that WSDL/XSD/Policy is the contract, period. Any other view of your contract is just an illusion.

2) Write your logical contract explicitly, EITHER by writing WSDL down to the portType level, and letting an implementation stub in the binding, policy and endpoint information OR by writing code like Clemens does, but always knowing EXACTLY what's it's doing to your real contract.

Alternatively, I supposed you could just not care about your real contract. When that stops working for you, there is a tool that can help. ;-)


Posted Feb 09 2005, 01:53 PM by tim-ewald

Comments

Kevin Dente wrote re: Clemens and I disagree on the importance of angle-brackets
on 02-09-2005 2:40 PM
It seems like these discussions rarely consider the target audience for these tools. Is it reasonable to expect Joe Average corporate IT developer to learn the ins and outs of XML schema and WSDL? Probably not. Those people are focused on providing business value, not maximizing reach, and for those folks, I think Clemens' approach is perfectly reasonable (and in fact they are probably less likely to screw things up with the toolkits than with hand-crafted WSDL). Any interop in that environment is likely limited to one or two platforms, and WS-I conformance most likely gives you anything you need.

On the other hand, the EBays of the world, for whom maximum reach has bottom line implications, will be more likely to craft their service interfaces more carefully. And, of course, XML wonks like you. :)

Neither approach is entirely right or entirely wrong - it depends on the environment and business needs.



Tim wrote re: Clemens and I disagree on the importance of angle-brackets
on 02-09-2005 3:25 PM
Kevin,

I agree that there have to be better tools to help make developers more productive. But we could build tools that make creating logical WSDL contracts much much easier. With VS.NET's built in XSD editor and the WSCF plugin from Thinktecture, you pretty much have everything you need.

Tim-
Dilip wrote re: Clemens and I disagree on the importance of angle-brackets
on 02-09-2005 4:19 PM

The problem with Thinktecture's WSCF is you need to have crafted the WSDL somehow, right? Even if you model your messages using XML Schema editor using VS.NET, it still leaves out the job of forming the actual WSDL, right? Seems we're missing a step in between?
Dilip wrote re: Clemens and I disagree on the importance of angle-brackets
on 02-09-2005 4:20 PM
BTW Tim, the font on this particular post is incredibly small. Can you fix it?
<savas:blog /> wrote Indigo
on 02-09-2005 4:41 PM
Indigo information is starting to appear. Here's an article-introduction to Indigo on MSDN by David Chappell, a "Hello world" post by Clemens Vasters, Christian is threatening to say more (can't wait:-), Steve is going over the same argument of OO usi...
Christian Weyer wrote re: Clemens and I disagree on the importance of angle-brackets
on 02-10-2005 12:05 AM
@Dilip: what do you mean by 'hand-crafting' the WSDL? With WSCF 0.4 there is a contract interface wizard which takes the message and data XSDs and you simply specify the operations of your interfaces. The tool then creates a WSDL which you never want or, better yet, need to see...
http://www.thiniktecture.com/WSCF/

The next version will have even better support with contract round-tripping and the like...

Thanks.
Radovan Janecek: Nothing Impersonal wrote Staring at WSDL
on 02-10-2005 1:10 AM
Tim nicely responded to Clemens. But if you work in a company that can't or won't commit itself to a single toolkit (and maybe even a single version of a single toolkit, depending on how versioning works), you probably can't take that path. There is no if. Every company has to stare at WSDL as there is no way to...
Dilip wrote re: Clemens and I disagree on the importance of angle-brackets
on 02-10-2005 4:25 AM
Christian
Sorry. I didn't look closely enough at WSCF. You are, of course, right.
Service Station wrote Will the real
on 02-10-2005 8:02 AM
Lorenzo Barbieri @ UGIblogs! wrote Non sono l'unico a storcere il naso...
on 02-10-2005 8:56 AM
Lorenzo Barbieri @ UGIblogs! wrote Non sono l'unico a storcere il naso...
on 02-10-2005 9:03 AM
Brain.Save() wrote There is no truth but what's on the wire
on 02-10-2005 4:38 PM
Brain.Save() wrote There is no truth but what's on the wire
on 02-10-2005 4:40 PM
Dave Bettin on Services wrote A Day of Indigo
on 02-10-2005 5:12 PM
William T wrote The Great XSD/WSDL/Policy Contract Divide
on 02-10-2005 6:49 PM
http://www.softwaremaker.net/blog/PermaLink,guid,cd3c52b8-7f7a-466e-a68c-149401598e13.aspx
Dare Obasanjo's WebLog wrote The Fallacy of
on 02-10-2005 7:57 PM
Sam Gentile's Blog wrote New and Notable 71
on 02-11-2005 7:45 AM
Christian Weyer: Smells like service spirit wrote Today and tomorrow: Will Indigo heal...? Powerful object model for contract-first glue
on 02-14-2005 6:22 AM
Il Blog di Paolo Pialorsi wrote Discutendo di contratti, WSDL e Indigo
on 02-14-2005 4:23 PM
Il Blog di Paolo Pialorsi wrote Discutendo di contratti, WSDL e Indigo
on 02-14-2005 4:34 PM
JCooney.NET wrote What defines a Service Contract
on 02-17-2005 6:42 AM
Claudio Brotto wrote Cose Nuove e Degne di Nota
on 02-18-2005 6:35 AM
Christian Weyer: Smells like service spirit wrote Today and tomorrow: Will Indigo heal...? Powerful object model for contract-first glue
on 02-19-2005 4:07 AM
Bogdan Nedelcu wrote legal vs. engineering
on 03-02-2005 11:09 AM
comments in my blog
Middleware Matters wrote Focus on the contract
on 03-28-2005 5:48 PM
Tim offers some extremely excellent advice (as usual) regarding what really matters when you write your services. If I may paraphrase what he says and perhaps embellish it a bit, starting from the implementation language and generating your contracts from it is just plain wrong, wrong, wrong, at least for systems of any appreciable magnitude, reach, or longevity. Instead, focusing on the contracts first is the way to go. I've written about this for many years now, starting well over a decade ago. When you start with the code rather than the contract, you are almost certainly going to slip up and allow style or notions or idioms particular to that programming language into your service contract. You might not notice it, or you might notice it but not care. However, the guy on the other side trying to consume your service from a different implementation language for which your...
Diana wrote Really COOL!
on 06-05-2005 2:31 PM
Wow, superb!
Thanks.