为什么我不能生成在Visual Studio这个WSDL文件的客户端code? [英] Why can't I generate client code from this WSDL file in Visual Studio?
问题描述
我想codeA .NET客户端的cleverreach API(WSDL文件:的 http://api.cleverreach.com/soap/interface_v4.php?wsdl ,在的 http://api.cleverreach.com/soap/interface_v4.php )在Visual Studio 2010。
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_v4.php ) in Visual Studio 2010.
现在的问题是,无论我做什么也似乎没有任何方法来创建C#code这个API并。
The problem is that no matter what I do there doesn't seem any way to create C# code for this API.
我已经试过两种方式 - 添加服务引用和Web引用。在这两个方面存在的API(类似createList或addBatch)的方法不会产生code。
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的/语言:CS /out:GeneratedProxy.cs /config:app.config http://api.cleverreach.com/soap/interface_v4.php?wsdl
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:
生成文件...警告:没有code 生成。如果你试图 生成客户端,这可能是 因为元数据实况ments做 不包含任何有效的合约或 服务或因为所有 合同/服务被发现到 存在于/参考assembl当中。 验证您通过了所有的 元数据文件的工具。
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.
当我看到在Web浏览器中的WSDL文件,方法我在寻找(createList例如)被提及。所以,我不知道是怎么回事。
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.
我想知道的:
- 为什么不能Visual Studio中创建客户端code这个Web服务?
- 我怎样才能解决这个问题呢?
谢谢
阿德里安
推荐答案
最有可能的,你没有得到任何code的原因是因为WSDL是无效的。只需在XMLSpy的打开它讲述的故事:
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>'
这是对
<xsd:element name="firstname" type="xsd:string" firstname="registered"/>
您可能需要与供应商联系,并询问他们的想法。
You might want to contact the vendor and ask them what they were thinking.
这篇关于为什么我不能生成在Visual Studio这个WSDL文件的客户端code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!