【问题标题】:Error when Running SvcUtil.exe Against Service WSDL针对服务 WSDL 运行 SvcUtil.exe 时出错
【发布时间】:2013-11-08 00:08:18
【问题描述】:

我正在尝试为另一个实体公开的 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 实用程序。我是在正确的轨道上,还是应该寻找其他地方?

感谢任何帮助。

【问题讨论】:

  • 如果您可以通过网络浏览器获取 wsdl 本身,请另存为文件并针对该文件运行 svcutil.exe。有进口吗?同时保存它们并调整 wsdl 以指向本地文件。
  • 感谢您的反馈。一个有问题的导入是:xmlns:s2="microsoft.com/wsdl/types"。如果你导航到那个 URL,那里什么都没有。有没有针对这种情况的解决方法?
  • 在 WSDL 文档中使用的命名空间 URI 不代表 URL。就像任何其他语言一样,它们是放在文档容器中的“唯一”字符串,以防止其中定义的类型与其他想要指定相同类型但来自不同命名空间的文档发生冲突。

标签: c# wcf web-services soap wsdl


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-08
    • 1970-01-01
    • 2016-04-28
    • 2010-12-10
    • 2014-10-31
    • 2018-07-07
    相关资源
    最近更新 更多