title: SOAP request with attribute
body: <p>I can not seem to find out how to set an attribute to a SOAP request without using the <strong>XSD_ANYXML</strong> encoding.</p>
  
  <p>The request parameter should look as follows</p>
  
  <pre><code>&lt;request
      xmlns:ns="/some/ns"&gt;
      ...
          &lt;ns:parameter attr="some attribute"&gt;
              value
          &lt;/ns:parameter&gt;
      ...
  &lt;/request&gt;
  </code></pre>
  
  <p>Of course the following code works, but it's rather ugly (ugly, because it uses string concatenation where it should <strong>use the SOAP_Client API</strong> and because it does not use the general namespace)</p>
  
  <pre><code>$param = new SoapVar(
      '&lt;ns_xxx:parameter xmlns:ns_xxx="/some/ns" attr="some attribute"&gt;
          value
       &lt;/ns_xxx:parameter&gt;',
      XSD_ANYXML
  );
  </code></pre>
  
  <p>Is there a better way to create a SOAP request parameter with a namespace and an attribute?</p>
  
  <p>I am looking for s.th. like the following (this is just some pseudo code using the <a href="http://php.net/manual/en/soapvar.soapvar.php" rel="noreferrer">SoapVar</a> API):</p>
  
  <pre><code>$param = new SoapVar(
      array(
          '_' =&gt; 'value',
          'attr' =&gt; 'some attribute'
      ), 
      SOME_ENCODING,
      null,
      null,
      null,
      '/some/ns'
  );
  </code></pre>