in

ASP.NET Weblogs

Christian Weyer: Smells like service spirit

What's first?

Taking Web services development a small step further - WsContractFirst Visual Studio .NET add-in version 0.3


Announcing the next version of thinktecture's Web services contract-first tool, WsContractFirst v0.3

UPDATE: I uploaded a revised version September 1, 2004 - small bugfix for the XML comments feature!

NOTE: Get the download at the end of this article

Maybe some of you know that I am a big believer in contract-based Web services design and development. Web services contracts can be expressed explicitly in .NET code (see Steve's opinion) or by using schema (XSD) and WSDL. When using the second approach you may want a tool that can generate .NET code from your WSDLs/XSDs.
The .NET Framework's and Visual Studio .NET's intrinsic tools somehow don't cut it, sorry.
So, did you ever want 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. Our add-in for Visual Studio .NET 2003 automatically determines the project's programming language and accordingly generates source code (currently C# and VB.NET are supported).

New Features in v0.3 (compared to v0.2):

  • More 'intuitive' GUI (e.g. default button, tooltips on controls etc.) - well at least for an angle brackets guy ... :)
    • If you right-click on a WSDL file in project you can choose 'Generate Web service Code...'
    • If you right-click on a project you can choose 'Choose WSDL to implement...'
    • And then there is still the Tools menu item 'Web service Contract-First...'
  • Can add an external WSDL to the project and generate code based on it. Just enter the URI of the WSDL into the textbox
    • via HTTP
    • via file system
  • Can mark classes as [Serializable]
  • Can generate collection-based members instead of arrays
  • Comment propagation from WSDL into proxy classes
  • Can enable automatic validation of incoming SOAP messages on service side (by using a custom SoapExtension)
  • Saves configuraton form settings
  • Some few bug fixes
This is the dialog you will be presented when choosing one of the above described options to enter the contract-first path in VS.NET:
 

This is the description of each option in the configuration dialog (from left to right, top to down):

  • The location of the Web service message and interface contract (WSDL). Can be a URL or file location.
  • Enable this if you want to generate consumer-side proxy code to consume a Web service based on the WSDL.
  • Enable this if you want to generate code for a service-side Web service facade based on the WSDL.
  • Check this to get public properties in your data classes instead of public fields.
  • Check this to get runtime serializable data classes.
  • Generates collection-based members instead of arrays.
  • Check this to enable Web service endpoint configuration in a .config file.
  • Check this to get read-only access to the actual SOAP message in your client code.
  • Enables XSD-based validation on incoming SOAP messages
  • Please enter the name of .NET proxy file that gets generated.
  • Please enter the name of .NET namespace for the client proxy.
  • Please enter the name of .NET service facade file that gets generated.
  • Please enter the name of .NET namespace for the service code.
  • Save dialog settings for future use.

When done, you will hopefully see this message when clicking the 'Generate' button ...


Feel free to leave any comments, flames, or rants here.
Special thanks to all testers (too many to list here ;)).


Download: Get it here (ca. 260 KB)

DISCLAIMER:
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.

Comments

No Comments