简体   繁体   中英

SOAP Web Service / VS2010 Add Service Reference

I am having problems gaining access to a clients web service online.

If I have the wsdl file, can I do "something" in VS2010 with it so I can add it as a reference and start my C# coding?

Thanks Paul

When you go to "Add Service Reference", the textbox that allows you to enter a URL, can also take a path on your local filesystem to a wsdl.

Additionally, while not the optimal route, you can also use the wsdl.exe/svcutil.exe utility (bundled with VS) to generate a proxy class. Adding a reference is the better way to go, but this is an additional option.

Adding the Service Reference as a local path worked for me like a charm. I would have voted +1 for xelco52, but my rep is too low...

Only 1 issue; one of my members of the class I've added does not work. I wonder if I need to use the sledgehammer ...?

If you have the WSDL file, under one of your projects in VS, right-click the References project folder and choose Add Service Reference. Click the Advanced button, and in the new dialog click Add Web Reference. Now, go find the WSDL file, either where you saved it or where you downloaded it, enter its location in the textbox, and click Go. VS will digest the WSDL and produce a class that is the service client, and others as necessary to implement custom types accepted by the service.

It's usually a good idea, if you have downloaded the WSDL, to include it as an item in the project that has the web reference; that allows it to be easily traversed as a reference source, and to be located should you need to recreate the web service classes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM