对服务WSDL运行SvcUtil.exe时出错

时间:2013-11-08 00:08:18

标签: c# wcf web-services soap wsdl

我正在尝试为另一个实体公开的SOAP服务创建服务代理。跑完后:

svcutil.exe https://<domain-omitted>/feed30/clientdataservice.asmx?wsdl

我收到以下错误:

Attempting to download metadata from 'https://<domain-
omitted>/feed30/clientdataservice.asmx' using WS-Metadata Exchange or DISCO
Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or services or because all contracts/services were discovered to exist in /reference assemblies. Verify that you passed all the metadata documents to the tool.

Warning: If you would like to generate data contracts from schemas make sure to use the /dataContractOnly option.

我在过去看到这可能与实用程序无法访问WSDL中的所有xmlns路径有关。那些是:

xmlns:s="http://www.w3.org/2001/XMLSchema" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
xmlns:s2="http://microsoft.com/wsdl/types/" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

WSDL中包含在import语句中的唯一一个是xmlns:s2 =“http://microsoft.com/wsdl/types/”

我找不到我曾经看过的信息,您可以手动下载每个模式文档并将其作为参数提供给svcutil实用程序。我是在正确的轨道上,还是应该在其他地方寻找?

感谢任何帮助。

1 个答案:

答案 0 :(得分:2)

Per MarvinSmit的评论,我手动将WSDL数据下载到本地文件中。我找到了对http://microsoft.com/wsdl/types/&#39; http://msdn.microsoft.com/en-us/library/jj675594(v=office.12).aspx&#39;通过Bing,&#39; {{3}}&#39;。我将其下载到自己的.xsd文件中。然后我将本地WSDL中的导入引用替换为本地XSD文件的导入引用。 Ran svcutil指向我的本地WSDL文件和 poof ,它生成了一个有效的代理。