【问题标题】:Is SVCUTIL.exe broken or is it the supplier's WSDL?SVCUTIL.exe 是否损坏或者是供应商的 WSDL?
【发布时间】:2011-10-02 23:17:42
【问题描述】:

我正在尝试使用 SDK 中的 SVCUTIL 来生成多个 Web 服务中的常用类型。当我尝试生成代码时,我得到了错误(显示在底部)——这些表明 WSDL 已损坏。但是,如果我在 ServiceReferences 中导入服务,Visual Studio 不会抱怨。 SVCUTIL 坏了吗?

WSDL 是公开的,并且是:

http://test.wlr3.net/empws/services/WLR3AssuranceServices?wsdl
http://test.wlr3.net/empws/services/WLR3BillingServices?wsdl
http://test.wlr3.net/empws/services/WLR3DialogueServices?wsdl
http://test.wlr3.net/empws/services/WLR3FulfillmentServices?wsdl
http://test.wlr3.net/empws/services/WLR3InventoryServices?wsdl
http://test.wlr3.net/empws/services/WLR3InventoryOrderServices?wsdl
http://test.wlr3.net/empws/services/WLR3InventoryTroubleReportServices?wsdl
http://test.wlr3.net/empws/services/WLR3InventoryWorkItemServices?wsdl
http://test.wlr3.net/empws/services/WLR3IssueServices?wsdl
http://test.wlr3.net/empws/services/WLR3ReportingServices?wsdl
http://test.wlr3.net/empws/services/WLR3SecurityServices?wsdl

如果您查看这些内容,您会看到很多常见类型和多个命名空间。我尝试将这些发送到 SVCUTIL 以生成代码,但它不喜欢 FulfillmentServices 和 InventoryServices 的:

 Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: Cannot import invalid schemas. Compilation on the XmlSchemaSet failed.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://imperatives.co.uk/V20']/wsdl:portType[@name='WLR3FulfilmentServices']

Error: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://imperatives.co.uk/V20']/wsdl:portType[@name='WLR3FulfilmentServices']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://imperatives.co.uk/V20']/wsdl:binding[@name='WLR3FulfillmentServicesHttpBinding']

Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://imperatives.co.uk/V20']/wsdl:binding[@name='WLR3FulfillmentServicesHttpBinding']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://imperatives.co.uk/V20']/wsdl:service[@name='WLR3FulfillmentServices']/wsdl:port[@name='WLR3FulfillmentServicesHttpPort']

【问题讨论】:

  • 您使用的是什么版本的 .NET?第一个对我有用。
  • 在这种情况下,它的目标是 3.5,因为库是共享的。 WSDL 可以很好地导入 Visual Studio,这是使用 SVCUTIL 获取类型的问题
  • 我应该指出,似乎只有 Inventory 和 Fulfillment WSDL 会产生错误
  • 我想我可能已经发现了原因。 InventoryServices 和 FulfilmentServices 的类型中有一个空的虚拟基本类型“Dto”。它只出现在这两个 wsdl 中,它们是在 SVCUTIL 中产生错误的。 WSDL 是有效的,所以我认为这是一个错误。将确认编辑这些结果是否会产生工作代码。

标签: wsdl svcutil.exe


【解决方案1】:

根据问题的 cmets,两个问题 WSDL 存在细微差别。我将这些与旧版本进行了比较,发现其中有一种基于称为“Dto”的虚拟基本类型的类型。

这仅适用于两种类型 - 一种在 Fulfillment Services 中,一种在 Inventory Services 中,这些也可以在其他 WSDL 中找到,但没有基础 - WSDL 文件不一致。

所以我可以在这里解释 SVCUTIL 并给供应商一脚..

感谢 John Saunders 的关注

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-13
    • 2011-03-01
    • 2021-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-08
    • 2013-12-02
    相关资源
    最近更新 更多