Je m'occupe de créer un serveur Soap en PHP5 grâce à SoapServer, et SoapClient (pour tester le Webservice). Cela implique la création manuelle du WSDL (d'ailleurs si vous avez des idées de librairies PHP pouvant générer un WSDL à partir de class PHP je suis preneuse).
J'ai cependant un soucis, je n'arrive pas à passer un simple tableau d'objets (stdClass) à mon Webservice. A l'arrivée ce tableau est "encapsulé" dans un objet stcClass (objet sdtClass comprenant mon tableau d'objet).
Exemple :
Tableau de départ passé au WS :
Code : Tout sélectionner
array(2) {
[0]=>
object(stdClass) (2) {
["nom"]=>
string(3) "truc"
["prenom"]=>
string(2) "toto"
}
[1]=>
object(stdClass) (2) {
["nom"]=>
string(3) "efhygh"
["prenom"]=>
string(2) "super"
}
}
Code : Tout sélectionner
object(stdClass)#5 (1) {
["Struct"]=>
array(2) {
[0]=>
object(stdClass) (2) {
["nom"]=>
string(3) "truc"
["prenom"]=>
string(2) "toto"
}
[1]=>
object(stdClass) (2) {
["nom"]=>
string(3) "efhygh"
["prenom"]=>
string(2) "super"
}
}
}
Sinon voici comment je l'ai déclaré dans WSDL :
Code : Tout sélectionner
<xsd:complexType name="personne">
<xsd:all>
<xsd:element name="nom" type="xsd:string"/>
<xsd:element name="prenom" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="personnes_array">
<sequence>
<element minOccurs="0" maxOccurs="unbounded" name="person" type="tns:personne"/>
</sequence>
</xsd:complexType>
<--! -->
<wsdl:message name='savePersonnesRequest'>
<wsdl:part name="personnes" element="xsd:personnes_array"/>
</wsdl:message>