Je me retrouve confronter à un problème avec un service web que je dois consommer.
Voici mon bout de code :
Code : Tout sélectionner
<?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('***', '***');
Code : Tout sélectionner
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
Code : Tout sélectionner
POST /***.asmx HTTP/1.1
Host: ***.fr
Content-Type: text/xml; charset=utf-8
Content-Length: [B]length[/B]
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="">[B]string[/B]</***_LOGIN>
<***_MOT_DE_PASSE xmlns="">[B]string[/B]</***_MOT_DE_PASSE>
</LOGIN_REQUEST>
</LoginRequest>
</soap:Body>
</soap:Envelope>
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.