Php - SOAP API with auth

I encounter some problems when I try to call a method of api with authentication.

 $auth = (object) array(
                'user'=>'user',
                'password'=>'password',
                'company'=> 'companyname'
          );
         
    $url = 'https://webservices.gocadservices.com/NVS?wsdl';
    
    $soap = new SoapClient('https://webservices.gocadservices.com/NVS?wsdl',$auth);
    echo $soap->nop();

I get an error : The user parameter is empty or missing.

My question : How can I send a request xml like this :

<?xml version='1.0' encoding='UTF-8'?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
<soapenv:Header> 
<xs:nvheader xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
<xs:nvcommand> 
    <xs:user>
          username
    </xs:user> 
    <xs:password>
         mot de passe
     </xs:password> 
     <xs:company>
          companyname
      </xs:company> 
</xs:nvcommand> 
</xs:nvheader> 
</soapenv:Header> 
</soapenv:Envelope> 

I must have this structure so that the API SOAP will work.
Thanks.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.