phpsoapnusoap

PHP SOAP : Fatal error: Uncaught SoapFault exception: [HTTP] An Authentication object was not found in the SecurityContext


I have the following error:

"PHP SOAP : Fatal error: Uncaught SoapFault exception: [HTTP] An Authentication object was not found in the SecurityContext"

I have tried to set up soap headers but it is not working:

$authvalues = array("username"=>"@@@@","password"=>"EEEEE");
$header =  new SoapHeader("SoapBaseNameSpace","ReqHeader", $authvalues, true);

$client->__setSoapHeaders(array($header));

Solution

  • Have you tried setting it in the options array?

    $options = array(
      "login" => 'login',
      "password" => 'pass'
    );
    
    $client = new SoapClient($wsdl, $options);