简体   繁体   中英

How to add SOAP-ENV:mustUnderstand="1" in <wsse:security> header using python zeep library

I want my XML request to look like this -

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
    <wsse:Security xmlns: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" SOAP-ENV:mustUnderstand="1">
from lxml.etree import QName
from zeep.utils import detect_soap_env
from zeep.wsse.utils import get_security_header

soap_env = detect_soap_env(root_node)
security = get_security_header(envelope)
security.set(QName(soap_env, "mustUnderstand"), "1")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM