It looks like there's a slight omission in the NuSOAP library... it assumes that the content headers MUST be "text/xml", so if your client is attempting to connect to a service that outputs application/soap+xml headers, you'll end up with errors like:
Response not of type text/xml: application/soap+xml; charset=utf-8
To test this, you may benefit from the following little function pattern, which I used to login to a SOAP service. Remember, print out the client object! You may not actually get a result to look at!
require_once('path/to/downloaded/libraries/nusoap.php');
var $endpoint = 'https://somedomain.com/path/to/soap/server/Login';
var $client; // the soapclient object
function SOAP_Login()
{
$this->client = new soapclient($this->endpoint);
$err = $this->client->getError();
if ($err)
{
// Display the error
echo '<p><b>SOAP Constructor error: ' . $err . '</b></p>';
exit;
// At this point, you know the call that follows will fail
}
$params = array(
'some' => 'thing.. depends on what the WSDL expects'
);
$result = $this->client->call('someFunction', $params);
print_r($result); // Without the fix, this prints nothing (i.e. false) !!!
print_r($this->client); // Instead, look at the state of the client object, specifically error_str and debug_str
}
When I printed my $result, I got nothing, but when I printed out the $client object, I could see that there were errors.
The little hack I implemented was in the nusoap.php file, around line 7500. Look for this if-statement:
if (!strstr($headers['content-type'], 'text/xml')) {
$this->setError('Response not of type text/xml: ' . $headers['content-type']);
return false;
}
And change it to this:
if (!strstr($headers['content-type'], 'text/xml') && !strstr($headers['content-type'], 'application/soap+xml') ) {
$this->setError('Response not of type text/xml: ' . $headers['content-type']);
return false;
}
All this does is it lets NuSOAP handle responses that issue an "application/soap+xml" header (which is a valid xml header).