【发布时间】:2009-04-16 20:48:48
【问题描述】:
为什么this WSDL file在VS2008中会生成一个空的服务代理?
如果您查看生成的 Reference.cs 文件,它是空的。有什么想法吗?
【问题讨论】:
标签: c# web-services wsdl
为什么this WSDL file在VS2008中会生成一个空的服务代理?
如果您查看生成的 Reference.cs 文件,它是空的。有什么想法吗?
【问题讨论】:
标签: c# web-services wsdl
右键单击 service reference , cofigure ,取消选中“Reuse types in referenced assembles”,然后单击 OK。尝试更新服务参考。这对我有用!
【讨论】:
您阅读过您的错误列表吗?我得到了以下信息:
Custom tool warning: There was a validation error on a schema generated during export:
Source:
Line: 144 Column: 12
Validation Error: Wildcard '##any' allows element 'http://search.yahoo.com/mrss:text', and causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.
Custom tool warning: 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://fliqz.com/services/search/20071001']/wsdl:portType[@name='IVideoSearchService']
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='http://fliqz.com/services/search/20071001']/wsdl:portType[@name='IVideoSearchService']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='basicHttpBinding_IVideoSearchService_20071001']
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://tempuri.org/']/wsdl:binding[@name='basicHttpBinding_IVideoSearchService_20071001']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:service[@name='VideoSearchService']/wsdl:port[@name='basicHttpBinding_IVideoSearchService_20071001']
Custom tool error: Failed to generate code for the service reference 'ServiceReference1'. Please check other error and warning messages for details.
编辑:我做了一些挖掘,发现了以下链接:
我尝试按照 ScottAnderson 在第一个链接中的说明进行操作,但无法使用它们生成客户端代理。也许你可以有更好的运气。
看来原因这不起作用是因为 Fliqz 使用 XmlSerializer 而不是 DataContract/MessageContract 作为其合同定义,而 WCF 不想很好地使用它们并生成不适当的 WSDL .如果您可以控制原始合同,您可能会解决问题并继续前进;不幸的是,你可能完全不走运。
如果您可以获取 ServiceContract 接口及其公开的类型,您也许可以手动生成自己的客户端。从我在那里看到的一些类名来看,Fliqz 似乎在他们的合同中暴露了内部对象,所以我怀疑你是否可以,你知道,打电话给他们并要求他们提供一个你可以引用的 .dll。
您可以尝试通过分析 WSDL 和 XSD 自己编写接口和数据/消息协定类型。不过,看起来这将是很多工作。
对不起,我帮不上忙。这似乎是 Fliqz 糟糕的 WCF 遗留支持和糟糕的架构/设计的结合。
【讨论】:
尝试将其添加为 .NET 2.0 Web 参考。
转到添加服务参考,然后单击“高级”按钮。然后,您可以选择将其添加为 .NET 2.0 Web 参考。我这样做了,并让它工作。我无法通过标准的“添加服务参考”
【讨论】:
我在您的 WSDL 中看不到任何
另外,您是从实时 URL 还是磁盘上的某些文件创建服务?如果您使用的是“磁盘上”文件:您是否还获得了此行中引用的“wsdl0”文件:
<wsdl:import namespace="http://fliqz.com/services/search/20071001" location="http://services.fliqz.com/LegacyServices/Services/search/R20071001/service.svc?wsdl=wsdl0"/>
马克
【讨论】: