.net 如何生成 WSDL 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11680570/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to generate a WSDL file?
提问by Anuya
i have created a webservice [.asmx] file. This web service will actually get a string as Input and insert the values to database.
我创建了一个网络服务 [.asmx] 文件。该 Web 服务实际上将获取一个字符串作为输入并将值插入到数据库中。
Now this webservice will be called by another application, so they are asking wsdl file from me to access consume this webservice.
现在这个网络服务将被另一个应用程序调用,所以他们要求我的 wsdl 文件访问使用这个网络服务。
I know that, wsdl can be created via cmd to generate a .cs or .vb or .dll files And there is also a xml generated when i user ?wsdl along with my URL
我知道,可以通过 cmd 创建 wsdl 以生成 .cs 或 .vb 或 .dll 文件并且当我使用 ?wsdl 和我的 URL 时还会生成一个 xml
But i am confused which one to provide ??!!!
但我很困惑提供哪一个??!!!
回答by lv2program
The ?wsdl on your URL is what you should provide however that means that it exists as an XML file somewhere in your project. I'm not a .net developer (java) but I do know that if ?wsdl gives it to you on the end of your url then it exists somewhere, you can just use the browser save as to save the file as a wsdl for your consumers for the time being.
URL 上的 ?wsdl 是您应该提供的,但这意味着它作为 XML 文件存在于您的项目中。我不是 .net 开发人员 (java) 但我知道如果 ?wsdl 在你的 url 末尾给你,那么它存在于某处,你可以使用浏览器另存为将文件保存为 wsdl您暂时的消费者。
回答by Syed Wayez
- Goto IIS
- Goto Content Veiw
- Browse the .asmx file
- In Browser at the end of the url add "?wsdl" and hit Enter
- This should now give you the wsdl of it.
- 转到 IIS
- 转到内容视图
- 浏览 .asmx 文件
- 在 url 末尾的浏览器中添加“?wsdl”并按 Enter
- 这现在应该给你它的 wsdl。
回答by sak
For a .asmx service running in IIS & ASP.NET, wsdl is automatically generated by using ?wsdl along with the service url. If the consumers have access to the deployed web service, then ?wsdl is the best way to provide them with service wsdl.
对于在 IIS 和 ASP.NET 中运行的 .asmx 服务,wsdl 是通过使用 ?wsdl 和服务 url 自动生成的。如果消费者可以访问已部署的 Web 服务,那么 ?wsdl 是为他们提供服务 wsdl 的最佳方式。
Otherwise, you can use WSDL.exe to generate wsdl and then pass it across.
否则,您可以使用 WSDL.exe 生成 wsdl,然后将其传递。
(Regarding, your question to Thomas, for consuming a web serivce from wsdl, you need to generate client/stubs from wsdl and then using this client, you can directly make calls to the web service.
(关于,您向 Thomas 提出的问题,为了从 wsdl 使用 Web 服务,您需要从 wsdl 生成客户端/存根,然后使用此客户端,您可以直接调用 Web 服务。
If the consumers are .NET application, then just add the service url as a web reference in the project, this should generate client/stubs from you. For Java, you can use some tools like wsdltojava to generate the client.)
如果消费者是 .NET 应用程序,那么只需在项目中添加服务 URL 作为 Web 引用,这应该会从您生成客户端/存根。对于 Java,可以使用 wsdltojava 之类的工具来生成客户端。)

