title: soapheader authenticate using php
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4319088/php-soapclient-and-a-complex-header">PHP SoapClient and a complex header</a>  </p>
  </blockquote>
  
  
  
  <p>I have this header structure:</p>
  
  <pre><code>&lt;soapenv:Header&gt;
    &lt;wsse:Security xmlns:wsse=”http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd” soapenv:mustUnderstand=”0”&gt;
      &lt;wsse:UsernameToken&gt;
      &lt;wsse:Username Type=”http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken”&gt;votre_login&lt;/wsse:Username&gt;
      &lt;wsse:Password Type=”http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText”&gt;votre_password&lt;/wsse:Password&gt;
      &lt;/wsse:UsernameToken&gt;
    &lt;/wsse :Security&gt;
  &lt;/soapenv :Header&gt;
  </code></pre>
  
  <p>How I put this in php using <code>__setSoapHeaders()</code> method? </p>
  
  <p>I tried: </p>
  
  <pre><code>$auth = array(
              'UsernameToken' =&gt; array(
                  'Username' =&gt; '*****',
                  'Password' =&gt; '*****'
              )
          );
  $header = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','Security',$auth, 0);
  $client-&gt;__setSoapHeaders($header);
  </code></pre>
  
  <p>and I have this error:</p>
  
  <blockquote>
    <p>com.ibm.wsspi.wssecurity.SoapSecurityException: WSEC5509E: Un jeton de
    sécurité dont le type est
    [<a href="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken]" rel="nofollow noreferrer">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken]</a>
    est requis.</p>
  </blockquote>