23

I have an old WSDL file and I want to use WCF to communicate with the service.

The WSDL is generated from a ASMX (I suppose but I am not sure).

What would be the required steps to communicate with it ?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Raha
  • 1,959
  • 3
  • 19
  • 28

3 Answers3

27

Right-click your project, and choose "Add Service Reference". Point to the WSDL. Click "Ok". That should be all.

enter image description here

Anssssss
  • 3,087
  • 31
  • 40
John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • 4
    I couldn't find a "browse" button - had to copy/paste the full path of the wsdl file in Visual Studio 2010. – Victor Chelaru Nov 30 '11 at 00:08
  • I did not refer to a "browse" button. What do you mean? – John Saunders Nov 30 '11 at 00:15
  • 3
    Oh, what I meant is that I'm used to apps that require you to enter a file name also having a "Browse" or "..." button so you can select the location. The Visual Studio UI is a little misleading in that it doesn't let you do that - you have to manually copy/paste the location of the wsdl file. As simple as it is after I know about it , it was definitely confusing at first. – Victor Chelaru Dec 07 '11 at 20:14
21

Use svcutil.exe to create a WCF proxy to call the service. Details here.

Anderson Imes
  • 25,500
  • 4
  • 67
  • 82
  • 1
    Ok I will give that a go ! There is a file wsdl.exe in visual studio and Windows SDK. I used that to generate a proxy class, is this the same as svcutil.exe ? Once I generate the proxy file, how should I use this generate proxy ? – Raha Jun 03 '09 at 23:13
  • 5
    Not the same. svcutil.exe is a tool that will generate proxy and stubs (and other things) for WCF. wsdl.exe does similar for ASMX. As of 2006, WCF has replaced ASMX as the preferred web services programming framework in .NET. So, ASMX is old, WCF is new. – Cheeso Jun 04 '09 at 13:40
8

wsdl.exe is the old web service (1.1) way of creating a proxy. The first thing to try is "Add Service Reference" as already mentioned. This uses svcutil.exe to create the proxy. If you need more control over how the proxy is created, you can use svcutil.exe from the command line with a variety of switches.

With that said... I have had trouble with older web service wsdls. In particular, an old Apache AXIS Web Service containing overloaded operations. Please see my post here for complete details. (My problem still isn't solved. I hope you don't encounter the same issues, but if you do and figure them out, please answer my question. :)

Community
  • 1
  • 1
Mark Good
  • 4,271
  • 2
  • 31
  • 43
  • 1
    There is no concept of "overloading" in web services. Apache should have known better, and hopefully they've learned by now. They also used to do fun things like emit schemas that reference types like apachesoap:XmlElement and then not define these types. Probably worked well if you were using Apache code to consume the service, but not otherwise. – John Saunders Jun 04 '09 at 00:22
  • Thanks for the comment, John. Apparently, WSDL 1.1 allowed overloads? (see http://webservices.xml.com/pub/a/ws/2003/01/08/randyray.html) The same service that I mentioned included a bunch of fault types that svcutil couldn't understand. I had a heck of a time getting it to work and only after I made significant edits to the proxy code. – Mark Good Jun 04 '09 at 00:57