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


   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,
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

käµfm³d 👽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 ...]

Open in new window

rgatigantiAuthor 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,
käµfm³d 👽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

Open in new window

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

using MyWSNamespace;

Open in new window

Then let's see where your code stands.
rgatigantiAuthor 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.
käµfm³d 👽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

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.