gpt4 book ai didi

c# - 无法从 VS2017 中的 WSDL 生成代理

转载 作者:太空狗 更新时间:2023-10-29 22:02:16 25 4
gpt4 key购买 nike

我有一个 WSDL,我尝试从 Visual Studio 2017 中生成客户端代理。

  1. 右键单击项目名称 (WinForm)
  2. 添加 > 服务引用
  3. 粘贴 WSDL 地址
  4. 点击确定

现在我得到了 1 个错误和 20 个警告

错误

Severity Code Description Project File Line Suppression State Error Custom tool error: Failed to generate code for the service reference 'ServiceReference1'. Please check other error and warning messages for details. WindowsFormsApp1 c:\users\Me\source\repos\WindowsFormsApp1\WindowsFormsApp1\Connected Services\ServiceReference1\Reference.svcmap 1

警告(其中一些)

Severity Code Description Project File Line Suppression State Warning Custom tool warning: 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='MyTest.GetInformation:v2']/wsdl:binding[@name='GetInformationBinding'] XPath to Error Source: //wsdl:definitions[@targetNamespace='MyTest.GetInformation:v2']/wsdl:service[@name='GetInformationService']/wsdl:port[@name='GetInformationPort'] WindowsFormsApp1 c:\users\Me\source\repos\WindowsFormsApp1\WindowsFormsApp1\Connected Services\ServiceReference1\Reference.svcmap 1

Severity Code Description Project File Line Suppression State Warning Custom tool warning: 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='MyTest.GetInformation:v2']/wsdl:portType[@name='GetInformationInterface'] XPath to Error Source: //wsdl:definitions[@targetNamespace='MyTest.GetInformation:v2']/wsdl:binding[@name='GetInformationBinding'] WindowsFormsApp1 c:\users\Me\source\repos\WindowsFormsApp1\WindowsFormsApp1\Connected Services\ServiceReference1\Reference.svcmap 1

Severity Code Description Project File Line Suppression State Warning Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter Error: The datatype 'MyTest.attentionSignal:v1:II' is missing. XPath to Error Source: //wsdl:definitions[@targetNamespace='MyTest.GetInformation:v2']/wsdl:portType[@name='GetInformationInterface'] WindowsFormsApp1 c:\users\Me\source\repos\WindowsFormsApp1\WindowsFormsApp1\Connected Services\ServiceReference1\Reference.svcmap 1

SoapUI 5.3.0 可以从同一个 WSDL 生成代理,我也可以在 VS2017 中使用 Web Reference(兼容模式 2.0)生成它。然而,后来的解决方案对我不起作用,因为我有来自此 WSDL v1 的代码,我想重用。

编辑:

这是 WSDL,将其添加为 VS 2017 中的服务引用,您应该会看到问题: https://1drv.ms/u/s!AskujIssKpne6170QEQdCLrkG8-u

最佳答案

  • 你应该使用浏览器在本地下载 wsdl 然后继续你的休息步骤
  • 右键单击项目名称 (WinForm)
  • 添加 > 服务引用
  • 粘贴 WSDL 本地路径并单击确定

更新:如果上述方法不起作用。您可以尝试另一种方法 - 使用以下命令通过 XSD.exe 创建 Web 代理

wsdl.exe [path To Your WSDL File] //in visual studio command line
  • 这将生成代理类,您可以将其复制/移动到您的项目并使用它。

关于c# - 无法从 VS2017 中的 WSDL 生成代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48811760/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com