title: Custom header using PHP soap functions
body: <p>I am having a problem getting a custom soap header to work with PHP5. Can anybody guide me please.</p>
  
  <p>What I require is something like this</p>
  
  <pre><code>&lt;SOAP-ENV:Header&gt;
    &lt;USER&gt;myusername&lt;/USER&gt;
    &lt;PASSWORD&gt;mypassword&lt;/PASSWORD&gt;
  &lt;/SOAP-ENV:Header&gt;  
  </code></pre>
  
  <p>What I get is : </p>
  
  <pre><code>&lt;SOAP-ENV:Header&gt;
    &lt;ns2:null&gt;
      &lt;USER&gt;myusername&lt;/USER&gt;
      &lt;PASSWORD&gt;mypassword&lt;/PASSWORD&gt;
    &lt;/ns2:null&gt;
  &lt;/SOAP-ENV:Header&gt; 
  </code></pre>
  
  <p>I would like to remove the namespace tags. 
  The code I use to get this is: </p>
  
  <pre><code>class Authstuff {
    public $USER;
    public $PASSWORD;
  
    public function __construct($user, $pass) {
      $this-&gt;USER = $user;
      $this-&gt;PASSWORD = $pass;
    }
  } 
  
  $auth = new Authstuff('myusername', 'mypassword');
  $param = array('Authstuff' =&gt; $auth);
  $authvalues = new SoapVar($auth,SOAP_ENC_OBJECT);
  
  $header = new SoapHeader('http://soapinterop.org/echoheader/',"null",$authvalues);
  </code></pre>
  
  <hr>
  
  <p>Null doesn't seem to pass.. with 'null' I still get name space as in second example.. how to exclude this NS... thanks for your help in advance..</p>
  
  <pre><code>$headers = array();
  $headers[] = new SoapHeader(null, 'USER', $username);
  $headers[] = new SoapHeader(null, 'PASSWORD', $password);
  
  $client-&gt;__setSoapHeaders($headers);
  try {
      $result = $client-&gt;getAvailableLicensedDNCount('ASX01');
      print_r($result);
  </code></pre>
  
  <blockquote>
    <p>Fatal error: SoapHeader::SoapHeader(): Invalid parameters. Invalid namespace. in /usr/home/deepesh/SoapCalls/deepesh7.php on line 29</p>
  </blockquote>