title: Returning an array of string from PHP SoapServer
body: <p>I am trying to build a soap service in PHP. The WSDL that I am using for the webservice was autogenerated by Visual Studio 2010 (I just used Visual Studio to create the WSDL, the actual server is being built in PHP with SoapServer). The requests to the soap service are being handled, but when I try return an array of string, the client is not getting any results back. Here is the relevant sections of the WSDL:</p>
  
  <pre><code>&lt;s:element name="getGroups"&gt;
      &lt;s:complexType&gt;
        &lt;s:sequence&gt;
          &lt;s:element minOccurs="0" maxOccurs="1" name="code" type="s:string" /&gt;
        &lt;/s:sequence&gt;
      &lt;/s:complexType&gt;
    &lt;/s:element&gt;
    &lt;s:element name="getGroupsResponse"&gt;
      &lt;s:complexType&gt;
        &lt;s:sequence&gt;
          &lt;s:element minOccurs="0" maxOccurs="1" name="getGroupsResult" type="tns:ArrayOfString" /&gt;
        &lt;/s:sequence&gt;
      &lt;/s:complexType&gt;
    &lt;/s:element&gt;
    &lt;s:complexType name="ArrayOfString"&gt;
      &lt;s:sequence&gt;
        &lt;s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" /&gt;
      &lt;/s:sequence&gt;
    &lt;/s:complexType&gt;
    .
    .
    &lt;wsdl:message name="getGroupsSoapIn"&gt;
       &lt;wsdl:part name="parameters" element="tns:getGroups" /&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="getGroupsSoapOut"&gt;
       &lt;wsdl:part name="parameters" element="tns:getGroupsResponse" /&gt;
    &lt;/wsdl:message&gt;
    .
    .
    &lt;wsdl:operation name="getGroups"&gt;
        &lt;wsdl:input message="tns:getGroupsSoapIn" /&gt;
        &lt;wsdl:output message="tns:getGroupsSoapOut" /&gt;
    &lt;/wsdl:operation&gt;
  </code></pre>
  
  <p>The PHP server code is as follows:</p>
  
  <pre><code>function getGroups($args)
  {
      return array('ArrayOfString' =&gt; array('hello world'));
  }
  
  $server = new SoapServer( 'admin.wsdl' );
  $server-&gt;addFunction('getGroups');
  try {
      $server-&gt;handle();
  }
  catch (Exception $e) {
      $server-&gt;fault('Sender', $e-&gt;getMessage());
  }
  </code></pre>
  
  <p>I also tried returning just <em>array('hello world')</em> from the PHP <em>getGroups</em> function, but that also did not work. Can someone please help me correct the PHP code for returning an array of string that will match my WSDL definition.</p>