title: Need help debugging a PHP 5 SOAP hello world application
body: <p>I've been trying to get PHP 5 SOAP extension to work after reading every tutorial there is on the web, but to no avail. This has been very frustrating and i would really appreciate it if someone could point out where i am going wrong and why.</p>
  
  <p>Thanks for your help in advance, and any more details needed i'll oblige.</p>
  
  <p>The WSDL is as follows :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;wsdl:definitions name="test"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
  xmlns:tns="http://tempuri.org/"
  xmlns:s1="http://microsoft.com/wsdl/types/"
  xmlns:s="http://www.w3.org/2001/XMLSchema"
  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
  targetNamespace="http://tempuri.org/"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"&gt;
  
  &lt;wsdl:types&gt;
  &lt;s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"&gt;
  &lt;s:import namespace="http://microsoft.com/wsdl/types/" /&gt;
  
  &lt;s:element name="getUser"&gt;
  &lt;s:complexType&gt;
  &lt;s:sequence&gt;
  &lt;s:element minOccurs="0" maxOccurs="1" name="username" type="s:string" /&gt;
  &lt;s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" /&gt;
  &lt;/s:sequence&gt;
  &lt;/s:complexType&gt;
  &lt;/s:element&gt;
  &lt;s:element name="getUserResponse"&gt;
  &lt;s:complexType&gt;
  &lt;s:sequence&gt;
  &lt;s:element minOccurs="0" maxOccurs="1" name="getUserResult" type="tns:bookUser" /&gt;
  &lt;/s:sequence&gt;
  &lt;/s:complexType&gt;
  
  &lt;/s:element&gt;
  
  &lt;s:complexType name="bookUser"&gt;
  &lt;s:sequence&gt;
  &lt;s:element minOccurs="1" maxOccurs="1" name="ID" type="s:int" /&gt;
  &lt;s:element minOccurs="1" maxOccurs="1" name="GUID" type="s1:guid" /&gt;
  &lt;s:element minOccurs="0" maxOccurs="1" name="login" type="s:string" /&gt;
  &lt;s:element minOccurs="0" maxOccurs="1" name="pass" type="s:string" /&gt;
  &lt;/s:sequence&gt;
  &lt;/s:complexType&gt;
  
  &lt;/s:schema&gt;
  &lt;/wsdl:types&gt;
  
  &lt;wsdl:message name="getUserSoapIn"&gt;
  &lt;wsdl:part name="parameters" element="tns:getUser" /&gt;
  &lt;/wsdl:message&gt;
  &lt;wsdl:message name="getUserSoapOut"&gt;
  &lt;wsdl:part name="parameters" element="tns:getUserResponse" /&gt;
  &lt;/wsdl:message&gt;
  
  
  &lt;wsdl:portType name="test"&gt;
  &lt;wsdl:operation name="getUser"&gt;
  &lt;wsdl:input message="tns:getUserSoapIn" /&gt;
  &lt;wsdl:output message="tns:getUserSoapOut" /&gt;
  &lt;/wsdl:operation&gt;
  &lt;/wsdl:portType&gt;
  
  &lt;wsdl:binding name="testBinding" type="tns:test"&gt;
  &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /&gt;
  &lt;wsdl:operation name="getUser"&gt;
  &lt;soap:operation soapAction="http://tempuri.org/getUser" /&gt;
  &lt;wsdl:input&gt;
  &lt;soap:body use="literal" /&gt;
  &lt;/wsdl:input&gt;
  &lt;wsdl:output&gt;
  &lt;soap:body use="literal" /&gt;
  &lt;/wsdl:output&gt;
  &lt;/wsdl:operation&gt;
  &lt;/wsdl:binding&gt;
  
  &lt;wsdl:service name="testService"&gt;
  &lt;wsdl:port name="testPort" binding="tns:testBinding"&gt;
  &lt;soap:address location="http://127.0.0.1/index.php" /&gt;
  &lt;/wsdl:port&gt;
  &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>The code for the server :</p>
  
  <pre><code>&lt;?php
  
  function getUser($param) {
  
  return array(
  'bookUser'=&gt;array
  (
  'ID'=&gt;1,
  'GUID'=&gt;2,
  'login'=&gt;$param-&gt;username,
  'pass'=&gt;$param-&gt;password
  )
  );
  }
  
  ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
  $server = new SoapServer("http://127.0.0.1/1.wsdl");
  $server-&gt;addFunction("getUser");
  
  $server-&gt;handle();
  
  ?&gt;
  </code></pre>
  
  <p>and the code for the client :</p>
  
  <pre><code>$client = new SoapClient("http://127.0.0.1/index.php?wsdl", array('exceptions' =&gt; 0));
  
  try {
  $arr_data = array
  (
  array
  (
  'username'=&gt;'xyz',
  'password'=&gt;'abc'
  )
  );
  print_r($client-&gt;__soapCall("getUser",$arr_data));
  }
  catch (SoapFault $result) {
  print_r($result);
  } 
  </code></pre>