Я пытаюсь использовать библиотеку Python Zeep для создания XML, который отправляется в Barra API.Однако атрибут «Path» для «PortfolioNode» не заполняется Zeep.Когда я создаю подобный код с библиотекой suds в Python, он работает как положено.
WSDL в .txt: https://gofile.io/?c=CvRHVD
import zeep
from lxml import etree
from barra_module.barra_config import user_id, password, client_id
url = "https://www.barraone.com/axis2/services/BDTService?wsdl"
client = zeep.client.Client(url)
factory = client.type_factory('ns0')
# Doesn't work because Path is not being filled for some reason.
node = factory.PortfolioNode(
Path="SOMEPATH",
PortfolioName="Google",
Owner="workflow",
)
# I don't know why, but this weird syntax is necessary
nodes = factory.PortfolioNodes(
_value_1=[{'PortfolioNode': [node]}]
)
tree = factory.PortfolioTree(
PortfolioNodes=nodes,
TreeName="MyTree",
Owner=user_id,
)
# Create xml file for the SubmitImportJob call
soup_object = client.create_message(client.service, 'SubmitImportJob', user_id, client_id, password, "my_job_name", None, None, None, [tree], None, None, None, None, None, None, None)
tree = etree.ElementTree(soup_object)
tree.write("debug_zeep.xml", pretty_print=True)
В результате получается XML:
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<ns0:SubmitImportJobRequest xmlns:ns0="http://barra.com/cp/bdtbeans">
<ns0:User>***</ns0:User>
<ns0:Client>***</ns0:Client>
<ns0:Password>***</ns0:Password>
<ns0:JobName>my_job_name</ns0:JobName>
<ns0:PortfolioTree TreeName="MyTree" Owner="***" BottomUpAggregation="false">
<ns0:PortfolioNodes>
<ns0:PortfolioNode Owner="workflow" Path="NotSet" AggregationType="NONE" PortfolioName="Google"/>
</ns0:PortfolioNodes>
</ns0:PortfolioTree>
</ns0:SubmitImportJobRequest>
</soap-env:Body>
</soap-env:Envelope>
Где ошибка в: Path="NotSet"
.Который должен быть Path="SOMEPATH"
.Я что-то упустил или это ошибка?