title: Python - Zeep SOAP Complex Header
body: <p>I'd like to pass "Complex" Header to a SOAP service with zeep library</p>
  
  <p>Here's what it should look like</p>
  
  <pre><code> &lt;soapenv:Header&gt;
        &lt;something:myVar1&gt;FOO&lt;/something:myVar1&gt;
        &lt;something:myVar2&gt;JAM&lt;/something:myVar2&gt;
   &lt;/soapenv:Header&gt;
  </code></pre>
  
  <p>I guess that I succeed in sending a header this way</p>
  
  <pre><code>header = xsd.Element(
      '{http://urlofthews}Header',
          xsd.ComplexType([
          xsd.Element(
          '{http://urlofthews}myVar1',
          xsd.String()),
          xsd.Element(
          '{http://urlofthews}myVar2',
          xsd.String())
          ])
      )
  
  header_value = header(myVar1='FOO',myVar2='JAM')
  print (header_value)
  datasoap=client.service.UserRessourcesCatalog(requete,_soapheaders=[header_value])
  </code></pre>
  
  <p>But I don't get how to declare and pass the namespace "something" in my Header with the XSD.</p>
  
  <p>Any Help ?</p>
  
  <p>Thx by advance.</p>
  
  <p>Best Regards</p>
  
  <hr>
  
  <p>As mentionned in the documentation</p>
  
  <p><a href="http://docs.python-zeep.org/en/master/headers.html" rel="noreferrer">http://docs.python-zeep.org/en/master/headers.html</a></p>
  
  <p>"Another option is to pass an lxml Element object. This is generally useful if the wsdl doesn’t define a soap header but the server does expect it."</p>
  
  <p>which is my case so I tried</p>
  
  <pre><code>try:
          import xml.etree.cElementTree as ET
      except ImportError:
          import xml.etree.ElementTree as ET
      ET.register_namespace('something', 'http://urlofthews')
  
      headerXML = ET.Element("soapenv:Header")
      var1 = ET.SubElement(headerXML, "something:myVar1")
      var1.text = "FOO"
      var2 = ET.SubElement(headerXML, "something:myVar2")
      var2.text = "JAM"
  
  
  headerDict=xmltodict.parse(ET.tostring(headerXML))
  print (json.dumps(headerDict))
  
      datasoap=client.service.UserRessourcesCatalog(requete,_soapheaders=headerDict)
  </code></pre>
  
  <p>But I get : ComplexType() got an unexpected keyword argument u'soapenv:Header'. Signature: ``</p>