24

based on the WSDL spec from W3 there is the possibility to add "wsdl:document" tags to the WSDL output so that people using that webservice have a better explanation/documentation about this webservice.

Does anybody know how to make WCF use these comments/descriptions, or how to write the code in C# that those comments are exported as part of the wsdl?

Thanks, Michael

5 Answers5

12

It seems that the community project WCFExtras on GitHub provides a work-around the limitations of .NET 3.5.

Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166
Joannes Vermorel
  • 8,976
  • 12
  • 64
  • 104
4

http://msdn.microsoft.com/en-us/library/aa717040.aspx

I think this will do what you want but it only will work for .NET clients.

George
  • 41
  • 1
4

If you're doing your design / coding in C# classes, adorned with [ServiceContract] and [OperationContract], then I don't know of any way to export documentation you might have on those classes and methods into the WSDL, unfortunately.

I was appalled by that too - I expected any /// comments on my classes and methods to show up in the WSDL - no luck :-(

Our solution now is this: 1) we create a basic "mockup" of our service interface with all operations in C# 2) we compile that into an assembly 3) we extract the metadata (WSDL, XSD) from that assembly and then throw away the C# "prototype" 4) we manually add comments (xs:annotation/xs:documentation) to the WSDL and XSD 5) from now on, the WSDL/XSD are the master - and we generate our interface from those descriptions

Cumbersome and annoying, but it works fairly ok for us.

I sure hope VS2010 / WCF 4.0 will bring us a bit more support in this area !!

Marc

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
1

WCF won't do it on it's own unfortunately. There are extensibility points for WSDL generation that you can use to accomplish this at least partially: Look up the IWSDLExportExtension interface.

Blem
  • 796
  • 16
  • 36
tomasr
  • 13,683
  • 3
  • 38
  • 30
  • Thanks - but that's just a first step. What I'd really like is the ability to export any "/// comments...." I made on the ServiceContract, OperationContract and DataContract into the WSDL and XSD. Any ideas? – marc_s Mar 27 '09 at 16:31
0
[WebService(Namespace = "XXXXXXXXXXXXX", **Description**="V0.2.42")]

Description put whatever you want in the .NET 4.0, not sure which versions... Probably a little late in answering, but answers seem more complex than required to add a blurb to WSDL only devs see.

Mario S
  • 11,715
  • 24
  • 39
  • 47
Rob
  • 9
  • 1