How do I add a WSDL to a Visual Studio 2005 project?
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."
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?
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.
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.
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.
Right click your web project and select 'Add web reference
' and basically follow the instructions.
To include all the service references as web references:
http://brijbhushan.net/2013/04/23/wsdl-ans-svcutil-add-web-service-reference-in-vs-20102012/
精彩评论