title: PHP SOAP how to create nested requests
body: <p>I'm really out of ideas with PHP SOAP client. Main reason for this is probably that I don't fully understand how SOAP and more so how PHP Soap-client works.</p>
  
  <p>I need to get nested elements (I hope that's the right term) from Soap client.</p>
  
  <p>Here is the example I try to create</p>
  
  <pre><code>   &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:hor="http://Horizon.ExternalServices" xmlns:hor1="http://Horizon.ExternalServices.AFS"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;tem:SomeFunction&gt;
           &lt;tem:foobar&gt;
              &lt;hor:Foo&gt;lorem&lt;/hor:Foo&gt;
              &lt;hor:Bar&gt;ipsum&lt;/hor:Bar&gt;
           &lt;/tem:foobar&gt;
           &lt;tem:bazbar&gt;
              &lt;hor1:Foo&gt;lorem&lt;/hor1:Foo&gt;
              &lt;hor1:Bar&gt;ipsum&lt;/hor1:Bar&gt;
              &lt;!--Optional:--&gt;
           &lt;/tem:bazbar&gt;
        &lt;/tem:SomeFunction&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>My first attempt was just to put entire structure as assosiated array (that has always worked before), but with these nested thingis it seems to be a no go. </p>
  
  <p>Then I tried several different methods to create the following structure with SoapVar and SoapParam but because I really don't seem to understand how they work most of the time I'm getting just the request without anything inside the body.</p>
  
  <p>I've read the documention on PHP, wikipedia and w3schools. I just don't seem to get a grasp on the concept.  </p>
  
  <p>I'd really appriciate if some one could give me link or anything that explains how the Soap-client actually works.  Also code examples would be much appriciated. </p>