Bonsoir à tous,

Je me retrouve confronter à un problème avec un service web que je dois consommer.

Voici mon bout de code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
ini_set('soap.wsdl_cache_enabled', '0');
ini_set('soap.wsdl_cache_ttl', '0');
 
$wsdl = 'http://***.asmx?WSDL';
$options = array(
    'login' => '***',
    'password' => '***',
    'location' => 'http://***.fr'
);
$client = new SoapClient($wsdl, $options);
 
$request = $client->LoginRequest('***', '***');
Et voici l'erreur qu'il m'affiche :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
Fatal error: Uncaught SoapFault exception: [HTTP] Method Not Allowed in ... 
Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', ...', 1, 0) 
#1 [internal function]: SoapClient->__call('LoginRequest', Array) 
#2 ...client.php(13): SoapClient->LoginRequest('...') 
#3 {main} thrown in ... on line 13
Et enfin, voici un bout du XML du Web service :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
POST /***.asmx HTTP/1.1
Host: ***.fr
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://***/LoginRequest"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <LoginRequest xmlns="http://***.org/">
      <LOGIN_REQUEST xmlns="http://***Login">
        <***_LOGIN xmlns="">string</***_LOGIN>
        <***_MOT_DE_PASSE xmlns="">string</***_MOT_DE_PASSE>
      </LOGIN_REQUEST>
    </LoginRequest>
  </soap:Body>
</soap:Envelope>
Quelqu'un aurait-il une idée sur la raison de cette erreur ?
Je pencherai pour le fait qu'il faille envoyer ma requête en POST et non en HTTP, mais je ne vois pas du tout comment m'y prendre.
Merci d'avance pour vos réponses.