【问题标题】:WebService Client Exception: Cannot Import wsdl:bindingWebService 客户端异常:无法导入 wsdl:binding
【发布时间】:2010-11-28 03:41:11
【问题描述】:

我在 WebService 客户端程序中收到以下错误/警告。

有人告诉我,如果我从 web.config 中删除协议,例如 HTTP/GET 和 HTTP/POST,它应该可以工作。但我使用的是 Windows 窗体。

如何在 Windows 窗体中执行相同的操作?

Warning 1 Custom tool warning: Cannot import wsdl:binding
Detail: The required WSDL extension element 'binding' from namespace 'http://schemas.xmlsoap.org/wsdl/http/' was not handled.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.webserviceX.NET']/wsdl:binding[@name='countryHttpGet'] C:\Users\user\Documents\Visual Studio 2010\Projects\PublicWebService\PublicWebService\Service References\CountryInfoWebSrv\Reference.svcmap 1 1 PublicWebService

Warning 2 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='http://www.webserviceX.NET']/wsdl:binding[@name='countryHttpGet']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.webserviceX.NET']/wsdl:service[@name='country']/wsdl:port[@name='countryHttpGet'] C:\Users\user\Documents\Visual Studio 2010\Projects\PublicWebService\PublicWebService\Service References\CountryInfoWebSrv\Reference.svcmap 1 1 PublicWebService

Warning 3 Custom tool warning: Cannot import wsdl:binding
Detail: The required WSDL extension element 'binding' from namespace 'http://schemas.xmlsoap.org/wsdl/http/' was not handled.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.webserviceX.NET']/wsdl:binding[@name='countryHttpPost'] C:\Users\user\Documents\Visual Studio 2010\Projects\PublicWebService\PublicWebService\Service References\CountryInfoWebSrv\Reference.svcmap 1 1 PublicWebService

Warning 4 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='http://www.webserviceX.NET']/wsdl:binding[@name='countryHttpPost']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.webserviceX.NET']/wsdl:service[@name='country']/wsdl:port[@name='countryHttpPost'] C:\Users\user\Documents\Visual Studio 2010\Projects\PublicWebService\PublicWebService\Service References\CountryInfoWebSrv\Reference.svcmap 1 1 PublicWebService

【问题讨论】:

  • 您从哪里获得 WSDL 文档? WSDL 文档描述的是什么类型的服务? WSDL 仅用于 SOAP 服务。 WCF 支持不使用 HTTP GET 的 SOAP 1.1 和 SOAP 1.2 服务。
  • 这是我正在使用的网络服务的链接webservicex.net/country.asmx

标签: c# .net wcf web-services compiler-errors


【解决方案1】:

如果您想使用 svcutil 生成服务代理,您必须删除与 http://schemas.xmlsoap.org/wsdl/http 命名空间相关的所有内容,前缀为 http。因此,您需要删除两个绑定和到 Web 服务端口。在这种情况下,您也不需要两种端口类型和几种消息类型。

【讨论】:

    【解决方案2】:

    如果您有 2 个项目使用相同的 wcf,则删除第二个引用并注释您使用相同 wcf 的代码。您可以在第一个项目中更新服务后使用。

    【讨论】:

      猜你喜欢
      • 2011-04-06
      • 2013-09-18
      • 2012-09-25
      • 2013-10-27
      • 1970-01-01
      • 2018-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多