title: cannot be serialized because it does not have a parameterless constructor soap client php
body: <p>I attempt to pull data from webservice using php soap client,
  but I got soap fault</p>
  
  <pre><code>SoapFault Object (
      [message:protected] =&gt; Server was unable to process request. ---&gt; There was an error generating the XML document. ---&gt; &lt;&gt;f__AnonymousType2a`2[System.String,System.Object[]] cannot be serialized because it does not have a parameterless constructor. 
      [string:Exception:private] =&gt; 
          [code:protected] =&gt; 0
          [file:protected] =&gt; /Users/resarahman/Documents/xampp/htdocs/testing/soap/test.php
          [line:protected] =&gt; 17
          [trace:Exception:private] =&gt; Array ( 
              [0] =&gt; Array ( 
                  [file] =&gt; /Users/resarahman/Documents/xampp/htdocs/testing/soap/test.php 
                  [line] =&gt; 17 
                  [function] =&gt; __call 
                  [class] =&gt; SoapClient 
                  [type] =&gt; -&gt; 
                  [args] =&gt; Array ( 
                      [0] =&gt; GetPublicSalesBanners 
                      [1] =&gt; Array ( 
                          [0] =&gt; Array ( 
                              [saleCategoryID] =&gt; 40F80218-A9E1-43C4-96FF-4C046D192A21 
                              [countryID] =&gt; AS 
                              [languageID] =&gt; EN 
                              [getTopThree] =&gt; 1 
                          ) 
                      ) 
                  ) 
              ) 
              [1] =&gt; Array ( 
                  [file] =&gt; /Users/resarahman/Documents/xampp/htdocs/testing/soap/test.php 
                  [line] =&gt; 17 
                  [function] =&gt; GetPublicSalesBanners 
                  [class] =&gt; SoapClient 
                  [type] =&gt; -&gt; 
                  [args] =&gt; Array ( 
                      [0] =&gt; Array ( 
                          [saleCategoryID] =&gt; 40F80218-A9E1-43C4-96FF-4C046D192A21 
                          [countryID] =&gt; AS 
                          [languageID] =&gt; EN 
                          [getTopThree] =&gt; 1 
                      ) 
                  ) 
              ) 
          ) 
          [previous:Exception:private] =&gt; 
          [faultstring] =&gt; Server was unable to process request. ---&gt; There was an error generating the XML document. ---&gt; &lt;&gt;f__AnonymousType2a`2[System.String,System.Object[]] cannot be serialized because it does not have a parameterless constructor. 
          [faultcode] =&gt; soap:Server 
          [detail] =&gt; )
  </code></pre>
  
  <p>The request and response</p>
  
  <p>Request :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.ozsale.com.au/API/V2"&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;ns1:GetPublicSalesBanners&gt;
              &lt;ns1:saleCategoryID&gt;40F80218-A9E1-43C4-96FF-4C046D192A21&lt;/ns1:saleCategoryID&gt;
              &lt;ns1:countryID&gt;AS&lt;/ns1:countryID&gt;
              &lt;ns1:languageID&gt;EN&lt;/ns1:languageID&gt;
              &lt;ns1:getTopThree&gt;true&lt;/ns1:getTopThree&gt;
          &lt;/ns1:GetPublicSalesBanners&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;soap:Body&gt;
          &lt;soap:Fault&gt;
              &lt;faultcode&gt;soap:Server&lt;/faultcode&gt;
              &lt;faultstring&gt;Server was unable to process request. ---&amp;gt; There was an error generating the XML document. ---&amp;gt; &amp;lt;&amp;gt;f__AnonymousType2a`2[System.String,System.Object[]] cannot be serialized because it does not have a parameterless constructor.&lt;/faultstring&gt;
              &lt;detail /&gt;
          &lt;/soap:Fault&gt;
      &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>Here my code so far:</p>
  
  <pre><code>&lt;?php
  // create a connection to the local host mono .NET pull back the wsdl to get the functions names
    // and also the parameters and return values
    $client = new SoapClient("http://www.ozsale.com.au/api/v2/api.asmx?WSDL",
      array(
        "trace"      =&gt; 1,    // enable trace to view what is happening
        "exceptions" =&gt; 0,    // disable exceptions
        "cache_wsdl" =&gt; 0) 
    );
  
    // get a response from the WSDL zend server function getQuote for the day monday
    $data = $client-&gt;GetPublicSalesBanners(array(
      'saleCategoryID' =&gt; '40F80218-A9E1-43C4-96FF-4C046D192A21',
      'countryID'=&gt; 'AS',
      'languageID'=&gt; 'EN', 
      'getTopThree' =&gt;'1'
    ));
  
    print_r($data);
  
    // display what was sent to the server (the request)
    echo "&lt;p&gt;Request :".htmlspecialchars($client-&gt;__getLastRequest()) ."&lt;/p&gt;";
    // display the response from the server
    echo "&lt;p&gt;Response:".htmlspecialchars($client-&gt;__getLastResponse())."&lt;/p&gt;";
    ?&gt;
  </code></pre>
  
  <p>Documentasi about the api can be found here <a href="http://www.ozsale.com.au/API/V2/api.asmx?op=GetPublicSalesBanners" rel="nofollow">http://www.ozsale.com.au/API/V2/api.asmx?op=GetPublicSalesBanners</a></p>
  
  <p>Anyone know what is wrong here ? is it my code or it is an issue with webservice ?</p>