WebService客户端异常:无法导入wsdl:binding

时间:2010-11-28 03:41:11

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

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

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

如何在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

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

如果您有两个使用相同wcf的项目,请删除第二个引用,并在使用相同代码的地方注释该代码。在第一个项目中更新服务后,您可以使用相同的内容。

相关问题