# Visual Studio 2008 not able to generate code for WSDL Web Reference

Hi,

I am using WSDL file to create the web reference URL. I could add the web reference URL to my project in visual studio. But I am not able to use the web service as the automatic code is not generated.

I am getting the following warning message:

Custom tool warning: DiscoCodeGenerator unable to initialize code generator.  No code generated.

It would be great if someone can help me to solve this issue.

Thank you,
Divya.
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Not sure of the answer to the above, but have you tried running the WSDL file through the WSDL.exe utility? You can access it by opening up a Visual Studio Command Prompt (under Start->Microsoft Visual Studio 2008->Visual Studio Tools). In the prompt, you can enter:
wsdl.exe C:\path\to\wsdl.exe

-- optionally, if XSDs are required for the types defined in the WSDL --

wsdl.exe C:\path\to\wsdl.exe C:\path\to\first.xsd [C:\path\to\second.xsd ...]

Author Commented:
Yes, I have tried to generate the code using wsdl.exe. I could generate C# code and I have added the .cs file to my project. But I am getting many build errors like

The type or namespace name 'HttpGetClientProtocol' does not exist in the namespace 'System.Web.Services.Protocols' (are you missing an assembly reference?)

I have added System.Web.Services reference also. I am guessing that the basic is problem is because I am using Http Get protocol while creating my WSDL file instead of SOAP protocol.

Can you help me how to use Http Get protocol with WSDL.

Thank you,
Divya.
Commented:
Have you (or can you) tried using the /namespace option with WSDL.exe? This will put all the generated classes into whatever namespace you designate. This will help to prevent naming collisions. The command line would be something like:

wsdl.exe /namespace:MyWSNamespace C:\path\to\wsdl.xsd


Once you do that, add a "using" directive to the file that will be attempting to call the service:

using MyWSNamespace;


Then let's see where your code stands.
Author Commented:
I have used /namespace and tried again. Before even I try to use the generated code I just built it and got so many errors. I have added the two .cs files that were generated to my project and compiled it.
Commented:
As mentioned above, are there any types used in the WSDL which are defined in external schema files? If so, you will have to include those on the command line to WSDL.exe.

Experts Exchange Solution brought to you by