title: php soap client, error from bad wsdl? "Uncaught SoapFault exception: [HTTP] Could not connect to host"
body: <p>I'm mostly new to SOAP, so I made a little test script to connect to my customer's server. They have a GetMessage command in there, that requires no input or authentication and is just intended to test connectivity:</p>
  
  <pre><code>&lt;?php
  ini_set('soap.wsdl_cache_enabled',0);
  ini_set('soap.wsdl_cache_ttl',0);
  
  $url        = "https://test.mycustomer.com/api/TestService.svc?wsdl";
  $client     = new SoapClient($url, array("trace" =&gt; 1, "exception" =&gt; 0));
  
  $result = $client-&gt;GetMessage(NULL);
  
  echo "&lt;pre&gt;".print_r($result, true)."&lt;/pre&gt;";
  if($result-&gt;GetMessageResult-&gt;Status == "Success")
  {
      echo "Item deleted!";
  }
  ?&gt;
  </code></pre>
  
  <p>If I run this in the command line I get:</p>
  
  <pre><code>Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /var/www/my.stage.com/htdocs/common/soaptest.php:8
  Stack trace:
  #0 [internal function]: SoapClient-&gt;__doRequest('&lt;?xml version="...', 'http://459265-d...', 'http://tempuri....', 1, 0)
  #1 [internal function]: SoapClient-&gt;__call('GetMessage', Array)
  #2 /var/www/my.stage.com/htdocs/common/soaptest.php(8): SoapClient-&gt;GetMessage(NULL)
  #3 {main}
    thrown in /var/www/my.stage.com/htdocs/common/soaptest.php on line 8
  </code></pre>
  
  <p>And from a browser I get:</p>
  
  <pre><code>PHP Notice: 'SoapClient::__doRequest() [soapclient.--dorequest]: php_network_getaddresses: getaddrinfo failed: Name or service not known' 
  </code></pre>
  
  <p>In their WSDL for this service, the string "459265" appears here:</p>
  
  <pre><code>&lt;wsdl:service name="TestService"&gt;
  &lt;wsdl:port name="BasicHttpBinding_ITestService" binding="tns:BasicHttpBinding_ITestService"&gt;
  &lt;soap:address location="http://459265-dev1/api/TestService.svc"/&gt;
  &lt;/wsdl:port&gt;
  &lt;wsdl:port name="BasicHttpsBinding_ITestService" binding="tns:BasicHttpsBinding_ITestService"&gt;
  &lt;soap:address location="https://test.mycustomer.com/api/TestService.svc"/&gt;
  &lt;/wsdl:port&gt;
  &lt;/wsdl:service&gt;
  </code></pre>
  
  <p>So my question is, is that correct? Should the WSDL have a local url like that, that I can't get to from my box?</p>
  
  <p>A little more info, when I do a var_dump on __getFunctions and __getTypes, I get</p>
  
  <pre><code>array(2) {
    [0]=&gt;
    string(53) "GetMessageResponse GetMessage(GetMessage $parameters)"
    [1]=&gt;
    string(53) "GetMessageResponse GetMessage(GetMessage $parameters)"
  }
  array(5) {
    [0]=&gt;
    string(21) "struct GetMessage {
  }"
    [1]=&gt;
    string(55) "struct GetMessageResponse {
   string GetMessageResult;
  }"
    [2]=&gt;
    string(8) "int char"
    [3]=&gt;
    string(17) "duration duration"
    [4]=&gt;
    string(11) "string guid"
  }
  </code></pre>