title: SOAP service returns empty array via WSDL instead of data from database
body: <p>I am trying to write my own SOAP server and to call methods via SoapClient(wsdl mode). I created methods in php, added an auto-generated wsdl file. I send request via SoapClient and server should work with Mysql and return results, but i am always getting empty response. I checked logs in MySQL and they show correct request that should return the data.</p>
  
  <pre><code>public function getCarMakes()
  {
      $carMakesArr = array();
      $sql = "SELECT * FROM cars order by make";
      try
      {
          foreach($this-&gt;conn-&gt;query($sql) as $row)
          {
              $carMakesArr[] = array( $row[0], $row[1], $row[2]);
          }
      }
      catch(Exception $e)
      {
          echo $e-&gt;getMessage();
      }
  
          return $carMakesArr;
  }
  </code></pre>
  
  <p>My WSDL file:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;!-- Generated by JAX-WS RI (http://jax-ws.java.net). RI's version is Metro/2.3.1-b419 (branches/2.3.1.x-7937; 2014-08-04T08:11:03+0000) JAXWS-RI/2.2.10-b140803.1500 JAXWS-API/2.2.11 JAXB-RI/2.2.10-b140802.1033 JAXB-API/2.2.12-b140109.1041 svn-revision#unknown. --&gt;
  &lt;definitions targetNamespace="http://wsdl.example.org/" name="ServerWS" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:tns="http://wsdl.example.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"&gt;
    &lt;types&gt;
      &lt;xsd:schema&gt;
        &lt;xsd:import namespace="http://wsdl.example.org/" schemaLocation="ServerWS_schema1.xsd"/&gt;
      &lt;/xsd:schema&gt;
    &lt;/types&gt;
    &lt;message name="buyCar"&gt;
      &lt;part name="parameters" element="tns:buyCar"/&gt;
    &lt;/message&gt;
    &lt;message name="buyCarResponse"&gt;
      &lt;part name="parameters" element="tns:buyCarResponse"/&gt;
    &lt;/message&gt;
    &lt;message name="getCarMakes"&gt;
      &lt;part name="parameters" element="tns:getCarMakes"/&gt;
    &lt;/message&gt;
    &lt;message name="getCarMakesResponse"&gt;
      &lt;part name="parameters" element="tns:getCarMakesResponse"/&gt;
    &lt;/message&gt;
    &lt;message name="getCarDetailsById"&gt;
      &lt;part name="parameters" element="tns:getCarDetailsById"/&gt;
    &lt;/message&gt;
    &lt;message name="getCarDetailsByIdResponse"&gt;
      &lt;part name="parameters" element="tns:getCarDetailsByIdResponse"/&gt;
    &lt;/message&gt;
    &lt;message name="searchByParams"&gt;
      &lt;part name="parameters" element="tns:searchByParams"/&gt;
    &lt;/message&gt;
    &lt;message name="searchByParamsResponse"&gt;
      &lt;part name="parameters" element="tns:searchByParamsResponse"/&gt;
    &lt;/message&gt;
    &lt;portType name="ServerWS"&gt;
      &lt;operation name="buyCar"&gt;
        &lt;input wsam:Action="http://wsdl.example.org/ServerWS/buyCarRequest" message="tns:buyCar"/&gt;
        &lt;output wsam:Action="http://wsdl.example.org/ServerWS/buyCarResponse" message="tns:buyCarResponse"/&gt;
      &lt;/operation&gt;
      &lt;operation name="getCarMakes"&gt;
        &lt;input wsam:Action="http://wsdl.example.org/ServerWS/getCarMakesRequest" message="tns:getCarMakes"/&gt;
        &lt;output wsam:Action="http://wsdl.example.org/ServerWS/getCarMakesResponse" message="tns:getCarMakesResponse"/&gt;
      &lt;/operation&gt;
      &lt;operation name="getCarDetailsById"&gt;
        &lt;input wsam:Action="http://wsdl.example.org/ServerWS/getCarDetailsByIdRequest" message="tns:getCarDetailsById"/&gt;
        &lt;output wsam:Action="http://wsdl.example.org/ServerWS/getCarDetailsByIdResponse" message="tns:getCarDetailsByIdResponse"/&gt;
      &lt;/operation&gt;
      &lt;operation name="searchByParams"&gt;
        &lt;input wsam:Action="http://wsdl.example.org/ServerWS/searchByParamsRequest" message="tns:searchByParams"/&gt;
        &lt;output wsam:Action="http://wsdl.example.org/ServerWS/searchByParamsResponse" message="tns:searchByParamsResponse"/&gt;
      &lt;/operation&gt;
    &lt;/portType&gt;
    &lt;binding name="ServerWSPortBinding" type="tns:ServerWS"&gt;
      &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/&gt;
      &lt;operation name="buyCar"&gt;
        &lt;soap:operation soapAction=""/&gt;
        &lt;input&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/input&gt;
        &lt;output&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/output&gt;
      &lt;/operation&gt;
      &lt;operation name="getCarMakes"&gt;
        &lt;soap:operation soapAction=""/&gt;
        &lt;input&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/input&gt;
        &lt;output&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/output&gt;
      &lt;/operation&gt;
      &lt;operation name="getCarDetailsById"&gt;
        &lt;soap:operation soapAction=""/&gt;
        &lt;input&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/input&gt;
        &lt;output&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/output&gt;
      &lt;/operation&gt;
      &lt;operation name="searchByParams"&gt;
        &lt;soap:operation soapAction=""/&gt;
        &lt;input&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/input&gt;
        &lt;output&gt;
          &lt;soap:body use="literal"/&gt;
        &lt;/output&gt;
      &lt;/operation&gt;
    &lt;/binding&gt;
    &lt;service name="ServerWS"&gt;
      &lt;port name="ServerWSPort" binding="tns:ServerWSPortBinding"&gt;
        &lt;soap:address location="http://localhost/soap/server.php"/&gt;
      &lt;/port&gt;
    &lt;/service&gt;
  &lt;/definitions&gt;
  </code></pre>
  
  <p>My XML schema:</p>
  
  <pre><code>&lt;xs:complexType name="getCarMakes"&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="id_array1" type="xs:string" minOccurs="0"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  
    &lt;xs:complexType name="getCarMakesResponse"&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="return" type="xs:string" minOccurs="0"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>My request via SoapClient:</p>
  
  <pre><code>$client = new SoapClient('http://localhost/soap/ServerWS.wsdl',
                          array('cache_wsdl' =&gt; WSDL_CACHE_NONE, 
                                'trace' =&gt; 1,
                                'soap_version' =&gt; SOAP_1_2)
                               );
  
  try
      {
  
          $arr = (array)$client-&gt;getCarMakes();
  
          echo "&lt;b&gt;First method:&lt;/b&gt; &lt;br&gt;";
  
      }
      catch(SoapFault $e)
      {
          echo $e-&gt;getMessage();
      }
      echo $client-&gt;__getLastRequest();
      echo $client-&gt;__getLastResponse(); 
       var_dump($arr);
  </code></pre>
  
  <p>It returns an empty array, however db is there and data is there. Request to db is correct, i initially created server in non-wsdl mode and it worked just fine.</p>
  
  <p>My request:</p>
  
  <pre><code>&lt;!--?xml version="1.0" encoding="UTF-8"?--&gt;
  &lt;env:envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://wsdl.example.org/"&gt;
  &lt;env:body&gt;&lt;ns1:getcarmakes&gt;&lt;/ns1:getcarmakes&gt;
     &lt;/env:body&gt;&lt;/env:envelope&gt;
  </code></pre>
  
  <p>The response, i get:</p>
  
  <pre><code>  &lt;env:envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://wsdl.example.org/"&gt;
      &lt;env:body&gt;&lt;ns1:getcarmakesresponse&gt;&lt;/ns1:getcarmakesresponse&gt;
      &lt;/env:body&gt;
    &lt;/env:envelope&gt;
  </code></pre>
  
  <p>Please advise.</p>