Mono wsdl 实用程序无法处理 eBay 的 SOAP API 的 WSDL 文件
我在尝试处理 eBay 的 WSDL 文件时从 Mono 的 wsdl 实用程序收到此错误 -
( http ://developer.ebay.com/webservices/latest/eBaySvc.wsdl )
$ wsdl eBaySvc.wsdl
Web Services Description Language Utility
Mono Framework v2.0.50727.1433
Error: XmlSchema error: Ambiguous element label which is contained by -any- particle was detected: urn:ebay:apis:eBLBaseComponents:PreferenceLevel Related schema item SourceUri: file:///home/manger/projects/ebay/eBaySvc.orig.wsdl, Line 10296, Position 7.
Stack:
at System.Xml.Schema.ValidationHandler.RaiseValidationEvent (System.Xml.Schema.ValidationEventHandler handle, System.Exception innerException, System.String message, System.Xml.Schema.XmlSchemaObject xsobj, System.Object sender, System.String sourceUri, XmlSeverityType severity) [0x00000]
at System.Xml.Schema.XmlSchemaObject.error (System.Xml.Schema.ValidationEventHandler handle, System.String message, System.Exception innerException, System.Xml.Schema.XmlSchemaObject xsobj, System.Object sender) [0x00000]
at System.Xml.Schema.XmlSchemaObject.error (System.Xml.Schema.ValidationEventHandler handle, System.String message) [0x00000]
在 Google 中搜索解决方案后发现,建议将以 eBayAPIInterfaceService service = new eBayAPIInterfaceService();
)时,我的 C# 程序出现运行时异常:
Unhandled Exception: System.InvalidOperationException: There was an error reflecting type 'AddDisputeRequestType'. ---> System.InvalidOperationException: There was an error reflecting field 'DetailLevel'. ---> System.InvalidOperationException: There was an error reflecting type 'DetailLevelCodeType'. ---> System.InvalidOperationException: There was an error reflecting type 'System.Object'. ---> System.InvalidOperationException: There was an error reflecting type 'AbstractResponseType'. ---> System.InvalidOperationException: There was an error reflecting field 'Errors'. ---> System.InvalidOperationException: There was an error reflecting type 'ErrorType'. ---> System.InvalidOperationException: There was an error reflecting field 'ErrorParameters'. ---> System.InvalidOperationException: There was an error reflecting type 'ErrorParameterType'. ---> System.InvalidOperationException: There was an error reflecting field 'Any'. ---> System.InvalidOperationException: The element Any has been attributed with an XmlAnyElementAttribute and a namespace '', but no name. When a namespace is supplied, a name is also required. Supply a name or remove the namespace.
at System.Xml.Serialization.XmlReflectionImporter.ImportAnyElementInfo (System.String defaultNamespace, System.Xml.Serialization.XmlReflectionMember rmember, System.Xml.Serialization.XmlTypeMapMemberElement member, System.Xml.Serialization.XmlAttributes atts) [0x00000]
at System.Xml.Serialization.XmlReflectionImporter.CreateMapMember (System.Type declaringType, System.Xml.Serialization.XmlReflectionMember rmember, System.String defaultNamespace) [0x00000]
at System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000]
--- End of inner exception stack trace ---
这里是 Mono 的 wsdl 工具有问题,还是 eBay 的 WSDL/架构? - 我看到的几个论坛帖子都说 WSDL 与架构不匹配,因此 Mono 正在做正确的事情,但我该如何修复它以便可以从 C# 实例化 Web 服务帮助程序类?
我的工具版本:
$ wsdl Web 服务描述语言实用程序 Mono 框架 v2.0.50727.1433
$ gmcs --version Mono C# 编译器版本 2.4.2.3
为 ErrorParameterType 生成的代码:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.1433")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:ebay:apis:eBLBaseComponents")]
public partial class ErrorParameterType {
private System.Xml.XmlElement[] anyField165;
... more class members follow ...
/// <remarks/>
[System.Xml.Serialization.XmlAnyElement(Namespace="")]
public System.Xml.XmlElement[] Any {
get {
return this.anyField165;
}
set {
this.anyField165 = value;
}
}
}
wsdl 在我的“修复”后生成的 eBayAPIInterfaceService.cs 文件是 此处
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道这是否能解决您的问题,但是
xs:any您问题中的
通配符 缺少两个'#'
:生成的 C# 代码包含许多如下定义:
来自 MSDN:
所以我猜解决方案是简单地删除
Namespace
属性值:I don't know if this solves your problem, but the
xs:any
wildcard in your question is missing two'#'
:The generated C# code contains lots of definitions like this:
From MSDN:
So I'd guess the solution is to simply remove the
Namespace
property values: