简体   繁体   English

在.NET中使用WCF,如何使其像ASMX一样自动生成SOAP文档?

[英]Using WCF in .NET how can I make it auto generate SOAP docs like ASMX did?

I'm currently writing a web service using WCF in VB.NET. 我目前正在VB.NET中使用WCF编写Web服务。

Previous web services I wrote used ASMX but I wanted to learn WCF and so far it's going well. 我以前编写的Web服务使用的是ASMX,但我想学习WCF,到目前为止一切顺利。 I actually prefer the way WCF does things. 我实际上更喜欢WCF的处理方式。

One thing I miss however is the way that ASMX used to generate example SOAP requests and responses. 但是我想念的一件事是ASMX用来生成示例SOAP请求和响应的方式。 It was like getting documentation for free. 就像免费获取文档一样。

Is there anyway to auto generate SOAP documentation for WCF? 无论如何,有没有为WCF自动生成SOAP文档的方法?

If not, is there any way to generate it in a .NET page using the WSDL? 如果没有,是否有任何方法可以使用WSDL在.NET页面中生成它?

I guess this isn't supported by WCF in the same way it was for ASMX because WCF supports multiple endpoint types, not just SOAP web services (eg Net TCP, named pipes, etc). 我想WCF不像ASMX那样支持它,因为WCF支持多种终结点类型,而不仅仅是SOAP Web服务(例如,Net TCP,命名管道等)。

SoapUI is a good little tool that can auto-generate SOAP messages from WSDL. SoapUI是一个很好的小工具,可以从WSDL自动生成SOAP消息。 Or you could create a small test client app, enable WCF tracing, and use the Service Trace Viewer Tool to view the messages that were sent. 或者,您可以创建一个小型测试客户端应用程序,启用WCF跟踪,然后使用Service Trace Viewer工具查看已发送的消息。

I eventually found the answer. 我终于找到了答案。 WCFExtras . WCFExtras The WCFExtras library allows you to document your API using XML comments and it reads those comments and inserts them into the WSDL as documentation comments. WCFExtras库允许您使用XML注释来记录API,并读取这些注释并将其作为文档注释插入到WSDL中。 We then read this and generate HTML documentation using an application called TechWriter. 然后,我们阅读并使用称为TechWriter的应用程序生成HTML文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使asmx和WCF的asp.net中的Web服务安全 - How to make web services secure in asp.net both the asmx and on WCF 如何确定.asmx JSON结果正在使用Newtonsoft.JSON? - How can I make sure .asmx JSON results are using Newtonsoft.JSON? 如何使用(asmx).net WebService从Android上传文件 - How can i upload file from Android using (asmx) .net WebService 我如何使用 ajax 和 asp.net asmx 页面为我的 html 表设置分页 - How i can set pagination to my html table using ajax with the asp.net asmx page 如何使用 SoapExtension 显示来自 asmx web 服务的原始 SOAP 消息 - How do I display raw SOAP messages from an asmx web service using SoapExtension 如何将标头中的用户名/密码传递给 SOAP WCF 服务 - How can I pass a username/password in the header to a SOAP WCF Service 我如何在.net项目中使用Google文档 - How can i use google docs in my .net project 如何在ASMX Web方法内生成500错误? - How do I generate a 500 error within an ASMX web method? 当我让我的(ASMX)web 服务接受/返回 JSON 而不是 XML 时,是否不再考虑 JSON - When I Make my (ASMX) web service accept/return JSON instead of XML, is it no longer considered SOAP? 如何缩小此ASP.NET ASMX到Exchange 2010托管API设置的故障点? - How can I narrow down the point of failure in this ASP.NET ASMX to Exchange 2010 Managed API setup?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM