NuSoap - How to use local, existing WSDL file in nusoap_client PHP
<p>I am new to nusoap, and web services in general. </p>

<p>The wsdl file comes from the client. I have a basic web service working with the default URL which supplies the wsdl via the web address: <code>http://hiddenurl.com/ws/schema/Terminal.wsdl</code></p>

<p>But the client's documentation says:
"Please download the WSDL and XML schema files locally for your code to use. Do not get those files every time from our server."</p>

<p>So I have been trying to host the wsdl file locally, or via my own web server, but neither have worked. </p>

<p>I have tried:</p>

<pre><code>$wsdlUrl = 'http://supplied-url.com/schema/Terminal.wsdl'    // working but discouraged

$wsdlUrl = 'http://my-own-IIS-based-url/schema/Terminal.wsdl'    // url loads and I can
  // view wsdl file, but when I load run webservice is returns blank / nothing 

$wsdlUrl = 'path/to/local/Terminal.wsdl'    // returns blank or 'boolean'false'

$tempUrl = realpath('path/to/local/Terminal.wsdl')    // get absolute url
wsdlUrl = tempUrl;    // returns blank screen or 'boolean'false'
</code></pre>

<p>Is there any way I can have the web service use the wsdl file from a location other than the one originally supplied by the client? I've seen some references to web servers returning wsdl with a sort of <a href="http://getfile.php?file.wsdl" rel="noreferrer">http://getfile.php?file.wsdl</a> but I don't understand what would be in the 'getfile.php' in order to deliver the wsdl via the query string.</p>

<p>Here is my PHP code to call the web service. Again, it works with the client supplied URL for the wsdl file, but not when I try to access the wsdl file any other way.</p>

<pre><code>&lt;?php
require_once('nusoap.php');

$URI = 'http://api.hiddenurl.com/ws/schema';

$env = 'api'; 
$wsdlUrl = 'http://'.$env.'.hiddenurl.com/schema/Terminal.wsdl';
$licenseKey = 'xxxx-xxxx-xxxx-xxxx-xxxx';
$userName = 'user';
$password = 'password';

$service = new nusoap_client($wsdlUrl, true);

// login credentials
$service-&gt;setHeaders(
'&lt;wsse:Security xmlns:wsse="http://hiddenurl.xsd"&gt;'.
'&lt;wsse:UsernameToken&gt;'.
'&lt;wsse:Username&gt;'.$userName.'&lt;/wsse:Username&gt;'.
'&lt;wsse:Password Type="http://hiddenurl#PasswordText"&gt;'.$password.'&lt;/wsse:Password&gt;'.
'&lt;/wsse:UsernameToken&gt;'.
'&lt;/wsse:Security&gt;'
);

$msg =
'&lt;GetDetailsRequest xmlns="'.$URI .'"&gt;'.
'&lt;messageId&gt;&lt;/messageId&gt;'.
'&lt;version&gt;&lt;/version&gt;'.
'&lt;licenseKey&gt;'.$licenseKey.'&lt;/licenseKey&gt;'.
'&lt;iccids&gt;'.
'&lt;iccid&gt;'.'xxxxxxxxxxxxxxx'.'&lt;/iccid&gt;'.
'&lt;/iccids&gt;'.
'&lt;/GetDetailsRequest&gt;';

$result = $service-&gt;call('GetlDetails', $msg);

if ($service-&gt;fault) {
  echo 'faultcode: ' . $service-&gt;faultcode . "\n";
  echo 'faultstring: ' . $service-&gt;faultstring . "\n";
  echo 'faultDetail: ' . $service-&gt;faultdetail . "\n";
  echo 'response: ' . $service-&gt;response;
  exit(0);
}

echo "&lt;pre&gt;";
var_dump($result);
echo "&lt;/pre&gt;";

?&gt;
</code></pre>

<p>Many thanks.</p>