我想用Python和zeep实例化一个在wsdl中为soapapi定义的匿名类型。 对于非匿名类型,我只使用这样的工厂
abcinstance = factory.abc('whatever', part2 = 'goes')
然后把它交给我需要调用的函数
client.service.doSomethingSpecial(abc = abcinstance)
但是在这里
abcdinstance = factory.abcd(Entries = ['something', key = 'else'])
不起作用,因为最后的“=”显然是错误的语法。需要一个包含一个位置参数和一个命名参数的列表,这只会增加我的困惑。我对Python很不熟悉,但是一定有一个简单的方法来解决这个问题,对吗?你知道吗
编辑:
因为你看不到zeep生成的代码。 生成的相关代码部分wsdl.exe文件在c#:
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "qwertz")]
public partial class abc
{
private abcEntry[] entriesField;
/// <remarks/>
[System.Xml.Serialization.XmlArrayItemAttribute("Entry", IsNullable = false)]
public abcEntry[] Entries
{
get
{
return this.entriesField;
}
set
{
this.entriesField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "qwertz")]
public partial class abcEntry
{
private string keyField;
private string valueField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public string key
{
get
{
return this.keyField;
}
set
{
this.keyField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public string Value
{
get
{
return this.valueField;
}
set
{
this.valueField = value;
}
}
}
我需要实例化类abc来将它赋给一个函数
zeep的结构有些不同:
abc要求如下
签名:Entries: {Entry: {xsd:string, key: xsd:string}[]}
目前没有回答
相关问题 更多 >
编程相关推荐