Bonjour,
Je souhaite consommer un webservice Soap en version 1.1.
Le WS demande un code client et me retourne un identifiant.
La fonction du WS s'appelle GetUtilisateur
L'instanciation se passe bien mais quand je demande de rechercher l'identifiant, j'ai un message d'erreur : "wrong version".
J'imagine que c'est un des paramètres qui est mauvais.
J'ai essayé en passant le wsdl en paramètre principal ou en passant tout dans les options sans succès.
Voici la requête qui fonctionne avec SoapUI et que je dois mettre dans mon code :
Voici les paramètres :Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://etnic.be/services/mimesis/administration/messages/v1" xmlns:v2="http://etnic.be/types/technical/addressing/v2" xmlns:v21="http://etnic.be/types/technical/authorisation/v2"> <soapenv:Header/> <soapenv:Body> <v1:GetUtilisateur> <v2:addressing> <!--Optional:--> <v2:routingFrom>http://service.etnic.be/eclass</v2:routingFrom> <!--Optional:--> <v2:routingTo>http://service.etnic.be/msis</v2:routingTo> <!--Optional:--> <v2:action>msis:administrationV1?mode=sync</v2:action> </v2:addressing> <v21:authorisation> <v21:userId>xxx</v21:userId> <v21:name></v21:name> <v21:firstName></v21:firstName> <!--Zero or more repetitions:--> <v21:profile>cfwb.transversal.wsmsis.admin_lect</v21:profile> </v21:authorisation> <v1:request> <v1:critereRecherche> <!--Optional:--> <v1:employerNumber>EDU1QAA</v1:employerNumber> <!--Optional:--> <v1:contexteCerbere>EDU</v1:contexteCerbere> </v1:critereRecherche> </v1:request> </v1:GetUtilisateur> </soapenv:Body> </soapenv:Envelope>
Voici le constructeur de ma classe :Code:
1
2
3 $urlWsdl = 'http://localhost/wsdlSource/wsdl/MSISAdministrationService_internal_v1.wsdl'; $uri = 'http://services-developpement.etnic.be/MSIS4_SERVICES/services/AdministrationPort';
Voici la méthode qui pose problème :Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 public function __construct($wsdlUrl, $userId, $users=null, $uri=null){ $this->userId = $userId; $this->uri = $uri; $options = array( 'location'=>$wsdlUrl, 'uri'=>$uri, 'style'=> SOAP_DOCUMENT, 'soap_version' => SOAP_1_1, 'trace' => 1, 'encoding'=>'UTF-8', 'exceptions' => true, 'cache_wsdl'=>WSDL_CACHE_NONE); try{ $this->soap = new SoapClient(null,$options); echo "<br>initialisation du client soap"; }catch(Exception $e){ echo "<br>" . $e->getTraceAsString() . "<br>". $e->getMessage(); } }
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 public function getIdTiers(string $employeeNumber):string{ $param = array( "addressing"=>array( "routingFrom"=>"http://service.etnic.be/eclasse", "routingTo"=>"http://servvice.etnic.be/msis", "action"=>"msis:administrationV1?mode=sync" ), "authorisation"=>array( "userId"=>$this->userId, "name"=>"xxx", "firstName"=>"xxx", "profile"=>"cfwb.transversal.wsmsis.admin_lect" ), "request" => array( "critereRecherche" => array( "employerNumber" => $employeeNumber, "contexteCerbere" => "EDU" ) ) ); try{ $utilisateur = $this->soap->GetUtilisateur($param); return $utilisateur->tiersId; }catch (Exception $e){ echo "<br>" . $e->getCode() . "<br>" . $e->getMessage(); } return ""; }