[Web Service][SOAP] client php et web service windev
Dans le cadre d'un projet de stage, j'ai mis en place un service web avec windev. La génération du service a bien crée une description WSDL du service et l'installation est effectuée sur un serveur soap. Le serveur a pu etre testé avec une appilcation cliente windev. Mon service web est donc bien fonctionnel selon moi.
Cependant, j'aimerais écrire un client en PHP 5 avec l'extension soap qui puisse appeler les fonctions de mon service web. J'utilise pour cela le serveur wamp afin d'avoir la version de php5 et toutes les librairies et extensions correspondante à la classe Soap.
Voici la description wsdl de mon service:
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 32 33
| <?xml version="1.0" encoding="iso-8859-1" ?>
- <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:s0="TestPE" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="TestPE">
- <types>
<xsd:schema elementFormDefault="qualified" targetNamespace="TestPE" />
</types>
<message name="TestPE_babar_MessageIn" />
- <message name="TestPE_babar_MessageOut">
<part name="parameters" type="xsd:string" />
</message>
- <portType name="TestPESOAPPortType">
- <operation name="babar">
<input message="s0:TestPE_babar_MessageIn" />
<output message="s0:TestPE_babar_MessageOut" />
</operation>
</portType>
- <binding name="TestPESOAPBinding" type="s0:TestPESOAPPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <operation name="babar">
<soap:operation soapAction="TestPE/babar" style="document" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <service name="TestPE">
- <port name="TestPESOAPPort" binding="s0:TestPESOAPBinding">
<soap:address location="http://formation4/TestPE/TestPE.soap" />
</port>
</service>
</definitions> |
Dans mon code client, je veux appeler une bete fonction "babar" qui ne prend aucun paramétres et qui renvoie juste une chaine de caractére. Voici mon code:
Code:
1 2 3 4 5 6 7 8 9
| <?php
$client = new SoapClient("http://formation4/TestPE/TestPE.xml");
var_dump($client->__getFunctions());
$result = $client->babar();
echo $result;
?> |
J'ai appeler avant la méthode getfunction pour vérifier si le client était bien instancié, et sa fonctionne. La ou sa coince c'est au nivo de l'appel de la fonction. meme avec la méthode soapCall j'ai la meme erreur:
Citation:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in C:\wamp\www\test3.php:8 Stack trace: #0 [internal function]: SoapClient->__call('babar', Array) #1 C:\wamp\www\test3.php(8): SoapClient->babar() #2 {main} thrown in C:\wamp\www\test3.php on line 8
Je ne comprend vraiment pas d'ou vient le probléme.
Auriez vous des suggestion pour me débloquer?
trés cordialement.