Link to home
Start Free TrialLog in
Avatar of rgatiganti
rgatiganti

asked on

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.
Avatar of kaufmed
kaufmed
Flag of United States of America image

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

Avatar of rgatiganti
rgatiganti

ASKER

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.
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.
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.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial