Christian Weyer: Smells like service spirit

What's first?

ANN: Improve your "Contract First" Web services development experience: WsContractFirst v0.2 - forget about wsdl.exe

A Visual Studio .NET Add-In for improved 'Contract First' Web services development

For quickstarters:

New features in 0.2 (download link at the end of the article):

  • Adding to the service side stub code generation, it now adds an .asmx default implementation (automatic WSDL generation disabled, obviously).
  • The client side developer gets access to the raw SOAP message - either as a byte[] or simply as a string.
  • Do you hate that wsdl.exe and the Visual Studio .NET "Add Web Reference ..." dialog always and only can produce public fields for members in data classes (based on the XSD)?
    This tool can optionally generate private fields with public property wrappers.
  • Dynamic vs. static URL reference (you can configure the Web service endpoint URL either in App.config or Web.config).
  • Serveral bug fixes and internal improvements

For a basic introduction:

I am happy to announce version 0.2 of a tool - a Visual Studio .NET Add-In - called WsContractFirst. The first bits (version 0.1) already have made it through the blogosphere and rumbled in Web services town - nice.
Microsoft obviously did not have enough time for adding a nice little feature to their prime IDE. So I had fun spending my time with getting to know the beloved and still COM-based extensibility model of Visual Studio .NET.

Yeah, a lot of people will rant that it is just the GUI-fied version of wsdl.exe - well, no. It is a complete new write-up, I am not leveraging wsdl.exe through the command line but use the .NET framework classes directly. So the code is completely extensible, sometime later I will eventually publish the code and might turn the whole thing into a GotDotNet Workspaces project.

So what does it do, dude?
Ever wanted to simply right-click on a WSDL file in Visual Studio .NET and generate code from that Web service contract? Now you can - whether it be a client-side proxy class or a server-side stub skeleton: you choose. The Add-In automatically determines the project's programming language and accordingly generates source code (currently C# and VB.NET supported). The tool's functionality can also be reached through a common menu item entry in VS.NET's Tools menu.

The Add-In handles the import of external schemas and WSDLs better than wsdl.exe. The code that makes the Add-In breathe is based on snippets of my formerly released DynWSLib to dynamically call Web services at runtime without 'any' knowledge of the WSDL beforehand (well, yes: this is somehow contradictory to the 'Contract First' approach. But it is actually useful in some verly limited uses cases such as testing. Actually the lib is used in a client side service invocation factory in a .NET-based Grid computing project). BTW, it would be nice if the server-side stub code would not produce an abstract class, but an interface instead - just what Indigo is capable of, as Don showed at PDC.


This is the second step in my and other's vision of first designing the Web services contract (and policy!) and then generating code skeletons from that. Hm, maybe there are some guys out there who can help me with the first step of visually designing the contract ... Chris, where are you?


  • Testing, testing, testing (can need your help here)
  • Adding desired features from users (well, need your help here, too :-))
  • Make it more sexy ...?

Feel free to leave any comments, flames, or rants here or there.
Special thanks for testing, ideas, comments, and testing go to Tomas, Pierre, Christoph, Ralf, Klaus and Scott - not to forget Yasser. Thanks guys.

Download: Get it here!

The sample is provided as is. Be sure that it is actually only a sample and does not in any sense conform to any coding guidelines and has not been proven to be a stable product! The code has not been reviewed by third parties or even been refactored for optimization - be sure that it is still much improvable.
The author cannot be made responsible for any damage or inconveniencies but is willed to accept any questions and comments to this sample. Please notice that this code is only a technology demo and should not be included unedited into any serious project.


No Comments