我用c#写了一个webservice,需要传两个参数,返回的是string[],现在用php调用,因为调用时必须使用NTLM authentication,我用了下面的class:class NTLMSoapClient extends SoapClient {
function __doRequest($request, $location, $action, $version) {
$headers = array(
'Method: POST',
'Connection: Keep-Alive',
'User-Agent: PHP-SOAP-CURL',
'Content-Type: text/xml; charset=utf-8',
'SOAPAction: "'.$action.'"',
);
$this->__last_request_headers = $headers;
$ch = curl_init($location);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_USERPWD, $this->user.':'.$this->password);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

$response = curl_exec($ch);
return $response;
}

function __getLastRequestHeaders() {
return implode("\n", $this->__last_request_headers)."\n";
}
}class MyServiceNTLMSoapClient extends NTLMSoapClient {
protected $user = ‘user’;
protected $password = ‘password’;
}我在调用的时候用了: $url = ‘http://url/service.asmx?wsdl’;
stream_wrapper_unregister('http');
stream_wrapper_register('http','MyServiceProviderNTLMStream') or die("Failed to register protocol");

 
$MyServiceNTLMSoapClient = new MyServiceNTLMSoapClient($url);

$result = $MyServiceNTLMSoapClient ->__call($function,$parms);

stream_wrapper_restore('http');不知道为什么一直返回的是FATAL EXCEPTION (PHP5) SoapFault exception: [soap:Server] Server was unable to process request. ---> Value cannot be null. 但是我在用c#调用这个webservice的时候是没有问题的,而我用同样的方法去调用不需要传参数的webservice也是没有问题的。哪位好心可以帮我看看究竟是什么问题。我一定给分的。