Bonjour,
Tout d'abord je ne sais si je suis dans la bonne section dans le cas contraire veuillez m'excusez.
J'essais de rédiger un wsdl pour la réception et l'envoi d'un d'un tableau.
Je me suis basé sur le tutoriel de :
Voici la partie soapclient :
Voici la partie soapserveur :
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 <?php $loadIn = array( 'url' =>'fr/' ); try{ ini_set('soap.wsdl_cache_enabled', 0); $client = new SoapClient("http://mondomaine.com/webservice/serveur/wsdl/exemple.wsdl",array('trace'=>1)); var_dump($client->__getFunctions()); $data_download = $client->__soapCall('load', $loadIn); echo "<p>REQUEST ID:\n" . $client->__getLastRequest() . "</p><pre>"; print_r($data_download); echo '</pre>'; }catch(Exception $e){ echo '<h1>EXECPTION</h1>'.$e->getMessage(); die(); }
Voici le wsdl :
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
18
19
20
21 <?php session_start(); class dispatcher { function __construct(){ } public function load($loadIn){ if(isset($loadIn['url'])){ return array('message'=>'JAI BIEN RECU LE TABLEAU : '.$loadIn['url']); }else{ return array('message'=>'NON IL NY A TOURJOURS PAS DE TABLEAU RECU'); } } } ini_set('soap.wsdl_cache_enabled', 0); $serversoap = new SoapServer("http://mondomaine.com/webservice/serveur/wsdl/exemple.wsdl", array( 'trace' => 1)); $serversoap->setClass("dispatcher"); $serversoap->handle(); ?>
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
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 <?xml version='1.0' encoding='UTF-8'?> <definitions name="exemple" targetNamespace="urn:exemple" xmlns:typens="urn:exemple" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:typens0="http://mondomaine.com/webservice/serveur/index.php"> <message name="loadRequest"> <part name="loadIn"/> </message> <message name="loadResponse"> <part name="loadReturn"/> </message> <portType name="essai_instancePortType"> <operation name="load" parameterOrder="loadIn" > <input message="wsdlns:loadRequest"/> <output message="wsdlns:loadResponse"/> </operation> </portType> <binding name="essai_instanceBinding" type="typens:essai_instancePortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="load"> <soap:operation soapAction="urn:essai_instanceAction"/> <input> <soap:body namespace="urn:exemple" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body namespace="urn:exemple" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <service name="exempleService"> <port name="essai_instancePort" binding="typens:essai_instanceBinding"> <soap:address location="http://mondomaine.com/webservice/serveur/index.php"/> </port> </service> </definitions>
Pour l'instant j'arrive a envoyer le tableau mais cela me fait une erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 array(1) { [0]=> string(29) "UNKNOWN load(UNKNOWN $loadIn)" } REQUEST ID: fr/ Array ( [message] => NON IL NY A TOURJOURS PAS DE TABLEAU RECU )
Partager