Python Zeep headers are a pain in the a**, please help me out.

Posted by Remarkable_Pianist_2@reddit | learnprogramming | View on Reddit | 2 comments

Hey everyone, i am a Junior Django Developer, and i need to use Zeep to connect with a Soap Server.
Documentation on Soap servers is scarce, so i would really like your help in modyfying it, cause i keep getting this :

ValueError : Invalid value for _soapheaders.

This is the code.
(if i remove the header, it works as it should based on the serverside description.
Thanks in advance.

header =    """<soapenv:Header>
                <wsse:Security soapenv:mustUnderstand="1" mlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                    <wsse:UsernameToken wsu:Id="UsernameToken-2">
                        <wsse:Username>***********************************</wsse:Username>
                        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">*****</wsse:Password>
                    </wsse:UsernameToken>
                </wsse:Security>
            </soapenv:Header>"""
print(client.service.releaseMngtAfe(audit_record,release_input,_soapheaders=header_dict))