title: SOAP PHP fault parsing WSDL: failed to load external entity?
body: <p>I'm trying to run a web service using PHP &amp; SOAP, but all I'm getting so far is this:</p>
  
  <blockquote>
    <p>(SoapFault)[2] message which states: 'SOAP-ERROR: Parsing WSDL: Couldn't load from '<a href="http://localhost/MyRegistration/login.xml" rel="noreferrer">http://localhost/MyRegistration/login.xml</a>' : failed to load external entity "<a href="http://localhost/MyRegistration/login.xml" rel="noreferrer">http://localhost/MyRegistration/login.xml</a>"</p>
  </blockquote>
  
  <p>I've tried changing localhost to 127.0.0.1, but that makes no difference. login is actually a wsdl file, but if I put login.wsdl in the SOAPClient constructor, it says "'looks like we got no XML document'" instead. </p>
  
  <p>Here is my code for the SOAP Client (register_client.php):</p>
  
  <pre><code>&lt;?php
  try
  {
      $sClient = new SoapClient('http://127.0.0.1/MyRegistration/login.wsdl');    
  
      $param1 = $_POST["regname"];
      $param2 = $_POST["regpass1"];
  
      $response = $sClient-&gt;loginVerify($param1, $param2);    
  
      var_dump($response);
  }
  catch(SoapFault $e)
  {
      var_dump($e);
  }
  ?&gt; 
  </code></pre>
  
  <p>And here is the login.wsdl file:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;definitions name="LoginVal" 
      targetNamespace="urn:LoginVal" 
      xmlns:tns="urn:LoginVal"  
      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
      xmlns="http://schemas.xmlsoap.org/wsdl/"&gt;
    &lt;types&gt;
  &lt;xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Login"&gt;
    &lt;xsd:element name="getName" type="xsd:string" /&gt;
  &lt;xsd:element name="getPass" type="xsd:string" /&gt;
    &lt;xsd:element name="LoginResponse" type="xsd:string" /&gt;          
  &lt;/xsd:schema&gt;           
    &lt;/types&gt;
  
    &lt;message name="loginVerify"&gt;
  &lt;part name="username" type="tns:getName" /&gt;
  &lt;part name="password" type="tns:getPass" /&gt;
    &lt;/message&gt;
  
    &lt;message name="doLoginResponse"&gt;
  &lt;part name="return" type="tns:LoginResponse" /&gt;
    &lt;/message&gt;  
  
    &lt;portType name="LoginPort"&gt;
      &lt;operation name="loginVerify"&gt;
    &lt;input message="tns:loginVerify" /&gt;
    &lt;output message="tns:doLoginResponse" /&gt;
      &lt;/operation&gt;
    &lt;/portType&gt;
  
    &lt;binding name="LoginBinding" type="tns:LoginPort"&gt;
      &lt;soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /&gt;
    &lt;operation name="loginVerify"&gt;
      &lt;soap:operation soapAction="urn:LoginAction" /&gt;
      &lt;input&gt;
        &lt;soap:body use="encoded" namespace="urn:Login" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /&gt;         
      &lt;/input&gt;
      &lt;output&gt;
        &lt;soap:body use="encoded" namespace="urn:Login" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /&gt;         
      &lt;/output&gt;
    &lt;/operation&gt;
    &lt;/binding&gt;
  
    &lt;service name="LoginService"&gt;
      &lt;port name="LoginPort" binding="tns:LoginBinding"&gt;
    &lt;soap:address location="http://localhost/MyRegistration/register.php" /&gt;
      &lt;/port&gt;
    &lt;/service&gt;
  
  &lt;/definitions&gt;
  </code></pre>
  
  <p>And I'm not sure if this is involved, so I'm providing the code for the SOAP Server register.php:</p>
  
  <pre><code>&lt;?php
  if(!extension_loaded("soap"))
  {
      dl("php_soap.dll");
  }
  
  ini_set("soap.wsdl_cache_enabled", "0");
  $server = new SoapServer("login.wsdl", array('uri'=&gt;'http://127.0.0.1/MyRegistration'))
  
  public function loginVerify($username, $password)
  {
      if($_POST["regname"] &amp;&amp; $_POST["regemail"] &amp;&amp; $_POST["regpass1"] &amp;&amp; $_POST["regpass2"] )
      {
          if($_POST["regpass1"] == $_POST["regpass2"])
          {
              $servername = "localhost";
              $username = "root";
              $password = "Hellfire";
  
              $conn = mysql_connect($servername,$username,"Hellfire")or die(mysql_error());
  
              mysql_select_db("soap",$conn);
  
              $sql = "insert into users (name,email,password)values('$_POST[regname]','$_POST[regemail]','$_POST[regpass1]')";
  
              $result = mysql_query($sql,$conn) or die(mysql_error());
  
              return "You have registered sucessfully";
  
              //print "&lt;a href='index.php'&gt;go to login page&lt;/a&gt;";
          }
          else return "passwords dont match";
      }
      else return "invalid data";
  }
  
  $server-&gt;AddFunction("loginVerify");
  $server-&gt;handle();
  ?&gt;
  </code></pre>
  
  <p>I'm sorry if I'm giving unnecessary information, but I'm a complete novice at this - and I'd really appreciate it if someone could point out why exactly this SOAP Fault is being generated, and what I can do to rectify it. </p>
  
  <p>I am using WAMP Server version 2.2, with mySQL 5.5.24 and PHP 5.3.13</p>