SOAP身份验证问题

时间:2011-09-08 05:54:10

标签: web-services authentication soap credentials nusoap

我对这个有点头疼。使用NuSOAP。

webservice有一个名为LOGIN的函数,它接受参数USER和PASSWORD。但是,无论我是尝试通过setCredentials进行身份验证还是通过使用参数调用函数,我所得到的只是同样的错误(对'null'的身份验证被拒绝)。这是我一直在玩的代码,在底部你会找到答案。


$client = new nusoap_client('http://user:pass@xx.xx.xx.xx:9999/service?wsdl', 'WSDL');

//tested including user and password
//$client = new nusoap_client('http://user:pass@xx.xx.xx.xx:9999/service?wsdl', 'WSDL');

//check if there were any instantiation errors, and if so stop execution with an error    message:
 $error = $client->getError();

 if ($error)
 {
   die("client construction error: {$error}\n");
 }

//authenticate to the service:

 $client->setCredentials('user', 'pass');

$param = array('user' => 'user',
           'password' => 'pass');

 $answer = $client->call('login', array('parameters' => $param), '', '', false, true);

构造函数错误

soapenv:Server: Auth rejected for 'null' (403)

错误

Array
(
    [faultcode] => soapenv:Server
    [faultstring] => Auth rejected for 'null' (403)
    [detail] => Array
        (
            [ChargingException] => Array
                (
                    [detail] => 
                    [message] => Auth rejected for 'null' (403)
                )

)

0 个答案:

没有答案