Information on How to Fix Your Webservice Client

Background: (Skip to the bottom if you don’t really want to understand)

In Visual Studio (VS) when web services work, they are nice and simple to understand.  When they don’t work, there’s no way of finding out what the real problem is.

In Visual Studio 2008 (and the editions before that), VS used WSDL.exe to consume the webservices for you to use.  Most people would simply right click on the project, type the webservice URL and then click add reference.  Most do not care about the specifics of how it was done.


Visual Studio 2010 threw out WSDL.exe and decided to use something called WCF (Windows Communication Foundation).  WCF uses version 4.0 of the framework.  Instead of adding a “Web Reference” you add a “Service Reference”.  I thought these were the same but one uses WSDL.exe and the other uses WCF (SVCUTIL.exe).


When the webservice/service reference is created right, you don’t care which one you use as long as it works.  Most don’t care about SOAP, WSDL, XML or anything else.  They just want to have a class that wrapped around the webservice and not think about all the little parts that don’t matter.

For my Taleo Reference that kept not working I would get errors like…

Unable to import binding ‘…Binding’ from namespace ‘…’
Custom tool error: Failed to generate code for the service reference ‘…’.  Please check other error and warning messages for details.   

It took some trial and error to figure out what exactly was happening wrong.  I quickly found a Microsoft Page about the error but did not think that was the problem but it ended up pretty much being that but the solution it gave was not pretty and has you rewriting the WSDL file.  Because the WSDL files in my case are so complex, I did not consider that an adequate solution.

The problem for me was that the WSDL file was trying to import an XSD schema and wasn’t doing it correctly.  For me WSDL.exe and SVCUTIL.exe kept failing because it did not import the “Schema” properly.

Fortunately you can use WSDL.exe and SVCUTIL.exe from the command line and add in the extra XSD’s that you want it to import.

WSDL.exe and SVCUTIL.exe simply create a C# (or VB) file that wraps up your webservice nicely.  Here are 2 examples…

WSDL.exe Example (VS2008 and Older)

cd "C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\Bin\"

wsdl /out:c:\MyProxyClass.cs /username:USER /password:PASSWORD /pd:PROXY-IF-YOU-USE-ONE /p:PROXY-PORT-IF-YOU-USE-ONE "https://WSDL-LOCATION.wsdl">https://WSDL-LOCATION.wsdl" ""

SVCUTIL.exe Example (VS2010 and Newer)

cd "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin"

svcutil /language:cs /out:c:\MyProxyClass.cs /config:app.config "https://WSDL-LOCATION.wsdl" ""

Note that if you use a proxy and SVCUTIL you may have to download the WSDL file as SVCUTIL does not work with proxies.  (Silly but true)

Leave a Reply

Your email address will not be published. Required fields are marked *

5 + eight =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>