I'm trying to create a custom SOAP header element using Zeep which uses several namespaces. When doing so, They are named ns0, ns1 and so on. For example:
usernametoken_header = xsd.Element('{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken', xsd.ComplexType([
xsd.Attribute('{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Id', xsd.String()),
xsd.Element('{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Username', xsd.String()),
xsd.Element('{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Password', xsd.String())
]))
Will have ns0 for what is wsse, and ns1 for what is wsu. Now I want to rename them to those values, but without repositioning the namespace declaration. I also don't want to use UsernameToken. I am aware of the option to do:
client.set_ns_prefix('wsse', "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")
But this repositions the namespace declaration from the first child that uses it, up to the root node. I do not want such repositioning. Is there any way to do a in-place renaming of the namespace?
from Create xsd.Element with specific namespace naming in Zeep
No comments:
Post a Comment