title: Nusoap PHP Client - Error 500
body: <p>Hi i'm trying to get some data through a WSDL file using NuSoap.</p>
  
  <p>the path to the wsdl file and the endpoint are below in the example.</p>
  
  <p>So far what I have is the following:</p>
  
  <pre><code>try {
                  require_once('../includes/nusoap/lib/nusoap.php');
  
                  $wsdl = 'https://service.stadt-zuerich.ch/jobs-ws/JobServiceV1/JobServiceV1.wsdl';
                  $endpoint = 'https://service.stadt-zuerich.ch/jobs-ws/JobServiceV1';
                  $username = "xxx";
                  $password = "xxx";
  
                  $client = new nusoap_client($wsdl,true);
  
                  $client-&gt;setEndpoint($endpoint);
                  $client-&gt;namespaces = array(
                      'SOAP-ENV'=&gt;"http://schemas.xmlsoap.org/soap/envelope/",
                      'v1'=&gt;"http://egov.stzh.ch/jobs/service/v1"
                  );
                  $client-&gt;setHTTPEncoding ($enc='gzip, deflate');
                  $client-&gt;loadWSDL();
                  $client-&gt;soap_defencoding = 'utf-8';
  
                  $header = '&lt;wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd"&gt;
                      &lt;wsse:UsernameToken&gt;
                          &lt;wsse:Username&gt;'.$username.'&lt;/wsse:Username&gt;
                          &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wssusername-token-profile-1.0#PasswordText"&gt;'.$password.'&lt;/wsse:Password&gt;
                      &lt;/wsse:UsernameToken&gt;
                  &lt;/wsse:Security&gt;';
  
                  $call = 'getJobs';
                  $param = array();       
                  $result = $client-&gt;call($call,$param,'','',$header);
  
                  echo '&lt;h2&gt;Request&lt;/h2&gt;&lt;pre&gt;' . htmlspecialchars($client-&gt;request, ENT_QUOTES) . '&lt;/pre&gt;';
                  echo '&lt;h2&gt;Response&lt;/h2&gt;&lt;pre&gt;' . htmlspecialchars($client-&gt;response, ENT_QUOTES) . '&lt;/pre&gt;';
                  echo '&lt;h2&gt;Debug&lt;/h2&gt;&lt;pre&gt;' . htmlspecialchars($client-&gt;debug_str, ENT_QUOTES) . '&lt;/pre&gt;';
  
              } catch (SoapFault $e) {
                  die($e-&gt;getMessage());
              }
  </code></pre>
  
  <p>The problem is that I'm getting an Internal Server Error 500 when trying to get the data. The Password and Username are correct (tried with the SoapUI App and there I'm getting all the data.)</p>
  
  <p>For the User and Password I tried to set a SoapHeader like in the example above and I also tried with the following, both not working. </p>
  
  <pre><code>$client-&gt;setCredentials($username,$password,'basic');
  </code></pre>
  
  <p>The endpoint should also be correct and I get the same header as the SoapUI app. I can't think of any other problems or solutions. </p>
  
  <p>This is my Soap request:</p>
  
  <p><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
     &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://egov.stzh.ch/jobs/service/v1"&gt;
     &lt;SOAP-ENV:Header&gt;
          &lt;wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd"&gt;
              &lt;wsse:UsernameToken&gt;
                  &lt;wsse:Username&gt;xxx&lt;/wsse:Username&gt;
                  &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wssusername-token-profile-1.0#PasswordText"&gt;xxx&lt;/wsse:Password&gt;
              &lt;/wsse:UsernameToken&gt;
          &lt;/wsse:Security&gt;
      &lt;/SOAP-ENV:Header&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;getJobs xmlns="http://egov.stzh.ch/jobs/service/v1"&gt;&lt;/getJobs&gt;
      &lt;/SOAP-ENV:Body&gt;
     &lt;/SOAP-ENV:Envelope&gt;</code></p>
  
  <p>and this one my Soap response:</p>
  
  <pre><code>HTTP/1.1 500 Internal Server Error
  Date: Mon, 02 May 2016 16:42:52 GMT
  Server: Entry Server
  Last-Modified: Wed, 20 Jan 2016 15:39:36 GMT
  ETag: "9ed-f19-529c5cb14fe00"
  Accept-Ranges: bytes
  Content-Length: 3865
  Content-Type: text/html
  Set-CookieSCDID_S=Zp0F6_uw2M4ClToXcA9L4bu6oav0UeSztcleiUXqkuT8XUl2mDBu1w$$; path=/;     Secure
  Connection: close
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de"&gt;
  &lt;head&gt;
  &lt;title&gt;Stadt Z&amp;uuml;rich: Interner Verarbeitungsfehler (Error 500)&lt;/title&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
  
  &lt;meta http-equiv="cache-control" content="no-cache" /&gt;
  &lt;meta http-equiv="Pragma" content="no-cache" /&gt;
  &lt;meta http-equiv="Expires" content="-1" /&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>Does anyone has any idea what I'm doing wrong? I appreciate every help since I'm sitting for hours on that problem.</p>
  
  <p>Thank you very much</p>