aminoo aminoo - 5 months ago 18
PHP Question

Soap authentification failed

I'm used to writing PHP code for a SOAP call
and this is my code

<?php
$client = new SoapClient("http://www.fma.fr/webservices_comparateurs/tarification_sante_comparateurs.asmx?wsdl");
$param = array('NomUtilisateur' => 'XXXXXX','MotDePasse' => 'XXYYZZ','ContenuDuMessage' => '');
$values = $client->TariferSante($param);

var_dump($values);

?>


when i execute the script I get an authentification error message:




object(stdClass)#2 (1) { ["TariferSanteResult"]=> string(109)
"err_authentification" }


the used parameters are true, you can try with this link:
http://www.fma.fr/webservices_comparateurs/tarification_sante_comparateurs.asmx?op=TariferSante

Answer

updated Answer : i tried this code and it worked

$options = array(
    'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
    'style'=>SOAP_RPC,
    'use'=>SOAP_ENCODED,
    'soap_version'=>SOAP_1_1,
    'cache_wsdl'=>WSDL_CACHE_NONE,
    'connection_timeout'=>15,
    'trace'=>true,
    'encoding'=>'UTF-8',
    'exceptions'=>true,

);

class TariferSante {

    public $nomUtilisateur;
    public $motDePasse;
    public $contenuDuMessage;
}
$client = new SoapClient("http://www.fma.fr/webservices_comparateurs/tarification_sante_comparateurs.asmx?wsdl",$options);

$param = new TariferSante();
$param->nomUtilisateur = "XXXXXXX";
$param->motDePasse = "XXYYZZ";
$param->contenuDuMessage = "";
$values = $client->TariferSante($param);
echo "Request".htmlspecialchars($client->__getLastRequest());

var_dump($values);