Why can't I generate client code from this WSDL file in Visual Studio?
I'm trying to code a .NET client for the cleverreach API ( WSDL file: http://api.cleverreach.com/soap/interface_v4.php?wsdl , documentation at http://api.cleverreach.com/soap/interface_v开发者_JAVA技巧4.php ) in Visual Studio 2010.
The problem is that no matter what I do there doesn't seem any way to create C# code for this API.
I've tried both ways - adding a service reference and a web reference. In both ways there was no code generated for the methods of the API (something like createList or addBatch).
I've also tried using the command line instead:
svcutil.exe /language:cs /out:GeneratedProxy.cs /config:app.config http://api.cleverreach.com/soap/interface_v4.php?wsdl
This just gives me an error message:
Generating files... Warning: No code was generated. If you were trying to generate a client, this could be because the metadata docu ments did not contain any valid contracts or services or because all contracts/services were discovered to exist in /reference assembl ies. Verify that you passed all the metadata documents to the tool.
When I look at the WSDL file in a web browser, the methods I am looking for (createList for instance) are mentioned. So I am not sure what is going on.
What I'd like to know:
- Why can't Visual Studio create the client-side code for this web service?
- How can I work around the problem?
Thanks,
Adrian
Most likely, the reason you didn't get any code is because the WSDL is not valid. Simply opening it in XMLSpy tells the story:
Invalid XML schema: 'Attribute 'firstname' is not allowed in element <xsd:element>'
That's on
<xsd:element name="firstname" type="xsd:string" firstname="registered"/>
You might want to contact the vendor and ask them what they were thinking.
This is a bit old, but in case it helps anyone, I was able to use the wsdl.exe
tool as described in Create web service proxy in Visual Studio from a WSDL file:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>wsdl http://api.cleverreach.com/soap/interface_v5.1.php?wsdl
Of course it doesn't help that the wsdl appears to have errors.
This is my first stack overflow answer so I apologies if it is not to the usual standard.
I have tested the service using visual studio, I created a new Project (.Net Application) added the service at this URL "http://api.cleverreach.com/soap/interface_v4.php?wsdl". Please note you WILL need the query string '?wdsl'), by adding a web reference I may have misunderstood your URL in your post but it looked like you were removing this.
I validated the WSDL file. I tested in VS 2008 and will test again in 2010.
Hope it helps :)
精彩评论