title: Structuring PHP array for use in SOAP with WSDL
body: <p>I am writing a SoapServer with PHP 5.2 to return a list of vacancies to another application. My WSDL doc requires a complex type along the lines of:</p>
  
  <pre><code>&lt;xsd:element name="Vacancies"&gt;                            
    &lt;xsd:complexType&gt;
      &lt;xsd:sequence&gt;  
        &lt;xsd:element name="Vacancy" type="ns:VacancyType" minOccurs="0" maxOccurs="unbounded"&gt;&lt;/xsd:element&gt;
      &lt;/xsd:sequence&gt;
    &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  </code></pre>
  
  <p>My function is generating a large, nested array to assemble each vacancy and then returning the array of arrays (ie: vacancies) to the SoapServer.</p>
  
  <p>Unfortunately, each array is indexed. So each VacancyType element within Vacancies has a unique index. This seems to throw the WSDL definition off and the data returned to me simply throws a parse error. I'd normally use associative arrays for key pair values, but as I'm dealing with n instances of VacancyType that wouldn't work as there wouldn't be a unique reference.</p>
  
  <p>Is there a known workaround for this kind of scenario (eg: maybe an object), or should I rework my WSDL doc to cater for indexed arrays?</p>
  
  <p>Thanks</p>