How to Consume a WebService using WSDL files in C#

27,321

Solution 1

You already found the solution. Use the "Add Service Reference" dialog and make sure your service is accessible by a URL. To do this either request the URL by the people offering the service or deploy the service in IIS.

Personally I would forget about svcutil.exe. If you have Visual Studio, it is much easier to add and update the service reference using the excellent integration of web services in Visual Studio.

Solution 2

Add your .wsdl address in address and click Go button.your service is add in your project.

enter image description here

Solution 3

You can use the wsdl.exe tool which comes with Visual Studio (in there you can specify a local file path to your wsdl file) -

http://msdn.microsoft.com/en-us/library/d2s8y7bs(VS.100).aspx

Solution 4

You can use svcutil.exe as such:

svcutil.exe /language:cs /out:MyServiceProxy.cs /config:app.config c:\path\to\my.wsdl

Solution 5

You can add a service reference by using the path to the wsdl files.

Share:
27,321
franciscovalera
Author by

franciscovalera

Updated on January 06, 2020

Comments

  • franciscovalera
    franciscovalera over 4 years

    So I have two wsdl files (xml based) and I need to use them to consume a web service. Not sure where to start? I'm trying to add them in my Visual Studio Project Solution by clicking on "Add Service Reference" but I need an URL.

    Should I add them to a Virtual Directory? If so, how?

    Thanks in advance