[Web Service] SOAP WSDL et complexType -> array of int
Bonjour et merci pour ce forum qui est une mine d'or pour trouver des infos.
Malheureusement j'ai pas mal écumé le web sans grande réponse à mon problème.
je suis actuellement en train de developper un webService utilisant SOAP.
Le Serveur soap fonctionne très bien.
Je rencontre juste un problème avec mon WSDL je voudrais déclarer un tableau (array sous PHP) en tant que paramètre d'une de mes fonctions.
voici mon WSDL
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:tns="urn:userservicewsdl"
targetNamespace="urn:userservicewsdl"
xmlns:typens="http://oes.oracle.com/OracleSearch"
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/">
<types>
<xsd:schema
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://oes.oracle.com/OracleSearch"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" >
<complexType name="arrayOfint">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:int[]"/>
</restriction>
</complexContent>
</complexType>
</xsd:schema>
</types>
<wsdl:message name="getTokenSoapIn" />
<wsdl:message name="getTokenSoapOut">
<wsdl:part name="return" type="xsd:string" />
</wsdl:message>
<wsdl:message name="createAccountSoapIn">
<wsdl:part name="token" type="xsd:string" />
<wsdl:part name="login" type="xsd:string" />
<wsdl:part name="password" type="xsd:string" />
<wsdl:part name="constructor_id" type="xsd:int" />
<wsdl:part name="group_id" type="xsd:int" />
<wsdl:part name="lastname" type="xsd:string" />
<wsdl:part name="firstname" type="xsd:string" />
<wsdl:part name="civility" type="xsd:string" />
<wsdl:part name="acces_type" type="tns:ArrayOfint" />
</wsdl:message>
<wsdl:message name="createAccountSoapOut">
<wsdl:part name="return" type="xsd:boolean" />
</wsdl:message>
<wsdl:message name="updateAccountSoapIn">
<wsdl:part name="token" type="xsd:string" />
<wsdl:part name="user_id" type="xsd:int" />
<wsdl:part name="password" type="xsd:string" />
<wsdl:part name="constructor_id" type="xsd:int" />
</wsdl:message>
<wsdl:message name="updateAccountSoapOut">
<wsdl:part name="return" type="xsd:boolean" />
</wsdl:message>
<wsdl:message name="disconnectSoapIn">
<wsdl:part name="token" type="xsd:string" />
</wsdl:message>
<wsdl:message name="disconnectSoapOut">
<wsdl:part name="return" type="xsd:boolean" />
</wsdl:message>
<wsdl:portType name="userservicewsdlSoap">
<wsdl:operation name="getToken">
<wsdl:input message="tns:getTokenSoapIn" />
<wsdl:output message="tns:getTokenSoapOut" />
</wsdl:operation>
<wsdl:operation name="createAccount"
parameterOrder="token user_id password constructor_id group_id lastname firstname civility acces_type">
<wsdl:input message="tns:createAccountSoapIn" />
<wsdl:output message="tns:createAccountSoapOut" />
</wsdl:operation>
<wsdl:operation name="updateAccount"
parameterOrder="token user_id password constructor_id">
<wsdl:input message="tns:updateAccountSoapIn" />
<wsdl:output message="tns:updateAccountSoapOut" />
</wsdl:operation>
<wsdl:operation name="disconnect">
<wsdl:input message="tns:disconnectSoapIn" />
<wsdl:output message="tns:disconnectSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="userservicewsdlSoap" type="tns:userservicewsdlSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc" />
<wsdl:operation name="getToken">
<soap:operation soapAction="urn:userservicewsdlgetToken" />
<wsdl:input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:userservicewsdl" />
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:userservicewsdl" parts="return" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="createAccount">
<soap:operation soapAction="urn:userservicewsdlcreateAccount" />
<wsdl:input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:userservicewsdl"
parts="token login password constructor_id group_id lastname firstname civility acces_type" />
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:userservicewsdl" parts="return" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateAccount">
<soap:operation soapAction="urn:userservicewsdlupdateAccount" />
<wsdl:input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:userservicewsdl" parts="token user_id password constructor_id" />
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:userservicewsdl" parts="return" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="disconnect">
<soap:operation soapAction="urn:userservicewsdldisconnect" />
<wsdl:input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:userservicewsdl" parts="token" />
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:userservicewsdl" parts="return" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="userservicewsdl">
<wsdl:port name="userservicewsdlSoap" binding="tns:userservicewsdlSoap">
<soap:address location="http://xxx.xxx.xxx/xxx/xxx/soap" />
</wsdl:port>
</wsdl:service>
</definitions> |
J'ai crée un type complexe appelé 'ArrayOfint' .
puis je passe le type au parametre de la fonction 'createAccount'
Code:
1 2
|
<wsdl:part name="acces_type" type="tns:ArrayOfint" /> |
Cependant dans mon code client
quand je veux passer un tableau en paramétre de ma fonction je fais
Code:
1 2
|
new SoapVar(array(1, 2) , SOAP_ENC_ARRAY, "ArrayOfint", "http://www.w3.org/2001/XMLSchema") |
Mais le script client me renvoie une erreur -> Internal Server Error
De plus quand je demande au WS de m'afficher les fonctions je vois que mon array est de type 'ArrayOfInt' et non array.
Le WSDL à été monté avec Zend Studio
et je remarque que pour mon complexType j'ai une erreur sur '<restriction base="SOAP-ENC:Array">':
Code:
1 2 3 4 5
|
Multiple annotations found at this line:
- s4s-att-invalid-value: Invalid attribute value for 'base' in element 'restriction'. Recorded reason: UndeclaredPrefix: Cannot resolve 'SOAP-ENC:Array' as a QName: the prefix 'SOAP-ENC' is not
declared.
- s4s-att-must-appear: Attribute 'base' must appear in element 'restriction'. |
Premiere question :
Comment bien déclarer un array d'entier dans le WSDL
Deuxieme question :
comment envoyer un array lors de l'appel à une fonction du WS ??
Merci pour votre aide et pour le temps passé à m'aidé
++