I have two WSDL files for creating a SOAP API, and would like to use them in Visual Studio. All the Googling I've done refers to a "Add Service Reference" to bring these in, but I don't see this option anywhere. I only have the option to enter a web address, which I don't have for these. Does anyone know a simple way to consume these WSDLs in VS 2017?
Asked
Active
Viewed 4,138 times
1
-
Your question is unclear. At one point you say you don't see the add service reference and another spot you say you have the option to enter a web address. Which is it? See this answer for using a filename in that dialog: https://stackoverflow.com/questions/1483178/how-can-i-consume-a-wcf-service-using-a-local-wsdl-file – John Koerner Oct 20 '17 at 23:25
-
Sorry, I only see Add Web Reference, but this only takes a URL and not a path from my computer where I have the files saved. – NandoAndes Oct 20 '17 at 23:35
-
You can create a proxy of wsdl using svcutil command. The proxy will be cs file with c# classes with methods. You can add that to your project and use it. – Chetan Oct 21 '17 at 00:43
1 Answers
4
Right Click your project> select "Add (D)" > click "Service Reference (S)"> Input your WSDL url and click "Move (G)" if you have the URL or "Explore (D)" if you have the WSDL in your solution. It should then pop-up below, and remember to NAME your namingspace(N), they are important. And "OK". It should pop-up in your project.
The above solution is only valid to certain project types. Eg: Xamarin.form doesnt have "Service Reference", hence alternative solution for that.
ELSE enjoy!
As for how to use those newly added WSDL. Simply go to your program and new them like any other classes or call them as you normally would. If it's in another project, then you have to USING XXXX;

That Snowing Summer
- 80
- 1
- 7