svcutil.exe 生成错误,而 wsdl.exe 运行时没有
我正在考虑生成符合 WSDL 的 Web 服务:
http://assets.cdn.gamigo.com/xml/connection-service/1.0.10/account.wsdl
当我像这样使用 svcutil.exe 运行时:
svcutil.exe /language:C# /out:GamigoServices.cs http://assets.cdn.gamigo.com/xml/connection-service/1.0.10/account.wsdl
我收到这些错误:
Error: Cannot import wsdl:binding
Detail: The given key was not present in the dictionary.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://connection.ga
mes.gamigo.com/v_1_0']/wsdl:binding[@name='DefaultAccountServiceServiceSoapBindi
ng']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://connection.ga
mes.gamigo.com/v_1_0']/wsdl:binding[@name='DefaultAccountServiceServiceSoapBindi
ng']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://connection.ga
mes.gamigo.com/v_1_0']/wsdl:service[@name='AccountService']/wsdl:port[@name='Acc
ountServicePort']
我还尝试了一个工具 Wscf:Blue,它给了我同样的错误(它是一个 WCF VS 插件,一旦我完成这一步,它可能会为我做更多的事情)。
另一方面,如果我使用 wsdl.exe(我不想要它,因为我想使用 WCF,并且据我所知,我需要为 WCF 使用 svcutil.exe,但我只是尝试了 wsdl.exe 来缩小问题的根源),如下所示:
wsdl.exe http://assets.cdn.gamigo.com/xml/connection-service/1.0.10/account.wsdl /serverInterface
没有错误。
我一直在尝试使用 WSDL 的本地副本(及其引用的 types.xsd)、注释部分等来缩小问题范围。然而,它实际上归结为错误消息所指的内容,即该绑定的定义。我也用谷歌搜索过,但对这种错误的少数引用根本没有帮助。 此外,令我特别困惑的是,wsdl.exe 似乎与该 WSDL 完美配合。我也用过 http://xmethods.net/ve2/WSDLAnalyzer.po# 验证 WSDL,否显示错误。
所以,现在我真的不知道如何继续。由于整个问题有点时间紧迫 - 到下周我应该真正开始实施 - 我可能最终会使用 wsdl.exe 生成的代码并采用 MS 废弃的旧技术,但出于几个(明显的)原因我宁愿不走那条路。因此,如果有人知道如何使 svcutil.exe 能够使用它,我将不胜感激。 我可能会补充一点,虽然我无法修改定义,但我也许能够说服该 WSDL 的发布者执行某些编辑或至少为我的目的发布第二个版本。
非常感谢,
马克斯·
维也纳,
奥地利
I'm looking into generating a web-service conforming to the WSDL found at:
http://assets.cdn.gamigo.com/xml/connection-service/1.0.10/account.wsdl
When I run with svcutil.exe like this:
svcutil.exe /language:C# /out:GamigoServices.cs http://assets.cdn.gamigo.com/xml/connection-service/1.0.10/account.wsdl
I get these errors:
Error: Cannot import wsdl:binding
Detail: The given key was not present in the dictionary.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://connection.ga
mes.gamigo.com/v_1_0']/wsdl:binding[@name='DefaultAccountServiceServiceSoapBindi
ng']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://connection.ga
mes.gamigo.com/v_1_0']/wsdl:binding[@name='DefaultAccountServiceServiceSoapBindi
ng']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://connection.ga
mes.gamigo.com/v_1_0']/wsdl:service[@name='AccountService']/wsdl:port[@name='Acc
ountServicePort']
I also tried a tool, Wscf:Blue, which gives me the same errors (it's a WCF VS plugin which, supposably, would do yet a lot more for me once I get past this step).
On the other hand, if I use wsdl.exe (which I don't want because I want to use WCF, and, as far as I understand, I need to use svcutil.exe for WCF, but I just tried wsdl.exe in my attempts to narrow down the source of the problems) like this:
wsdl.exe http://assets.cdn.gamigo.com/xml/connection-service/1.0.10/account.wsdl /serverInterface
there are no errors.
I've been trying all kinds of things with local copies of the WSDL (and the types.xsd which it references), commenting out sections etc. to narrow down the problem. However, it really boils down to exactly what the error message is referring to, the definition of that binding. I've also googled, but the few references to this kind of error are not helpful at all.
Besides, I'm particularly puzzled by the fact that wsdl.exe seems perfectly fine with that WSDL. I also used
http://xmethods.net/ve2/WSDLAnalyzer.po# to validate the WSDL, no errors were shown.
So, now I'm at the point where I really got no idea how to proceed. As the whole issue is somewhat time-critical - by next week I should really start with implementation -, I might end up using the code generated by wsdl.exe and going for the older technology obsoleted by MS, but for several (obvious) reasons I'd rather not go that route. So if anyone has any idea what to do to make svcutil.exe work with that, I'd be grateful.
I might add that while I cannot modify the definition, I might be able to convince the publisher of that WSDL to perform certain edits or at least publish a second version for my purposes.
Many thanks,
Max
Vienna,
Austria
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
步骤1。盯着您的 WSDL 文件
第 2 步。确保 wsdl:portType 与 wsdl:binding “一致”(即所有操作都在 portType 和绑定下以相应的方式定义)。
步骤3。感谢我在处理 svcUtil 错误(例如“字典中不存在给定的键”)时提供的最佳建议:-)
step1. Stare at your WSDL file
step2. ensure that the wsdl:portType "aligns with" wsdl:binding (i.e. all operations are defined in a corresponding way under portType and binding).
step3. Thank me for the best advice ever when dealing with svcUtil errors such as "the given key was not present in the dictionary" :-)
Svcutil.exe 用于 WCF 服务。如果它是一个 Web 服务 wsdl.exe 将正常工作。我认为您正在使用 svcutil.exe 作为 Web 服务,因此出现错误。
Svcutil.exe is used for the WCF service. If its a web service wsdl.exe will work fine. I think you are using the svcutil.exe for the web service so it is giving error.