visual-studio 如何将 WSDL 添加到 Visual Studio 2005 项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2700193/
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 do I add a WSDL to a Visual Studio 2005 project?
提问by Ben McCormack
One of our vendors provides a web service API to allow their customers to validate data in a database. As part of their SDK, they provide a WSDL (Web Service Definition Language) file that, according to their documentation, can "be read by software applications and application development tools. An application tool such as Microsoft's Visual Studio can import a WSDL document and automatically generate software classes that access the Web Services the WSDL defines."
我们的一个供应商提供了一个 Web 服务 API,以允许他们的客户验证数据库中的数据。作为他们 SDK 的一部分,他们提供了一个 WSDL(Web 服务定义语言)文件,根据他们的文档,该文件可以“被软件应用程序和应用程序开发工具读取。诸如 Microsoft 的 Visual Studio 之类的应用程序工具可以导入 WSDL 文档和自动生成访问 WSDL 定义的 Web 服务的软件类。”
I'm currently using Visual Studio 2005. What do I need to do to get Visual Studio to do the magic code generation for me?
我目前使用的是 Visual Studio 2005。我需要做什么才能让 Visual Studio 为我生成魔术代码?
UPDATE:This wasn't obvious to me, but if you have a static WSDL file stored locally on your computer, you can just paste the file path (e.g. C:\WSDLFiles\Service.WSDL) into the address bar of the Web Reference dialog box.
更新:这对我来说并不明显,但是如果您的计算机本地存储有静态 WSDL 文件,您只需将文件路径(例如C:\WSDLFiles\Service.WSDL)粘贴到 Web 参考对话框的地址栏中即可。
采纳答案by Bremer
If you right click on the project in the solution explorer, and select “Add Web Reference…” you will get a dialog to link the WSDL file to your project. Visual Studio will then download the WSDL and generate all the stuff needed to use the interface in the IDE.
如果您在解决方案资源管理器中右键单击该项目,然后选择“添加 Web 引用...”,您将看到一个对话框,将 WSDL 文件链接到您的项目。然后,Visual Studio 将下载 WSDL 并生成在 IDE 中使用该界面所需的所有内容。
The WSDL should be exposed at the URL of their web service, you don't link to the file they gave you. I imagine that the file is just for reference.
WSDL 应该在他们的 Web 服务的 URL 上公开,你不要链接到他们给你的文件。我想该文件仅供参考。
回答by Dan Diplo
Right click your web project and select 'Add web reference' and basically follow the instructions.
右键单击您的 Web 项目并选择“ Add web reference”,然后基本上按照说明进行操作。
回答by Cornel Urian
To include all the service references as web references:
要将所有服务引用包含为 Web 引用:
http://brijbhushan.net/2013/04/23/wsdl-ans-svcutil-add-web-service-reference-in-vs-20102012/
http://brijbhushan.net/2013/04/23/wsdl-ans-svcutil-add-web-service-reference-in-vs-20102012/

