Adding comments to a WSDL output from WCF/.Net

前端 未结 5 797
暖寄归人
暖寄归人 2020-12-29 23:15

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/docum

相关标签:
5条回答
  • 2020-12-29 23:43

    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

    0 讨论(0)
  • 2020-12-29 23:44

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

    0 讨论(0)
  • 2020-12-29 23:45

    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.

    0 讨论(0)
  • 2020-12-29 23:45

    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.

    I have a small example on how to implement a simple WSDL export extension up on my website which might help you get started.

    0 讨论(0)
  • 2020-12-29 23:57
    [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.

    0 讨论(0)
提交回复
热议问题