I want to instantiate an anonymous type that is defined in a wsdl for a soap API with Python and zeep. For non-anonymous types i simply use a factory like this
abcinstance = factory.abc('whatever', part2 = 'goes')
and afterwards give it to the function that i need to call
client.service.doSomethingSpecial(abc = abcinstance)
However here
abcdinstance = factory.abcd(Entries = ['something', key = 'else'])
doesnt work, because the last '=' is apparently wrong syntax. That a List is required that takes one positional Argument and one named only adds to my confusion. I am quite unfamiliar with Python, but there must be an easy way to solve this, right?
EDIT:
Since you cant see the generated code by zeep. The relevant code part as generated by wsdl.exe in 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;
}
}
}
I need to instantiate the class abc to give it to a function
The structure in zeep is a bit different:
abc requires the following
Signature: Entries: {Entry: {xsd:string, key: xsd:string}[]}