[gSoap] Envoyer un stl::vector ou un array multidimensionnel par gSoap
Bonjour à tous.
J'ai une fonction webservice codée en PHP, recevant un tableau de tableaux de string, et l'écrivant dans un fichier.
Le WSDL est le suivant :
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
|
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="ADRESSE_WEBSERVICE" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="BoWS" targetNamespace="ADRESSE_WEBSERVICE">
<types>
<xsd:schema targetNamespace="ADRESSE_WEBSERVICE"/>
</types>
<portType name="BoWSPort">
<operation name="writeArray">
<documentation>This method count and write an array</documentation>
<input message="tns:writeArrayIn"/>
<output message="tns:writeArrayOut"/>
</operation>
</portType>
<binding name="BoWSBinding" type="tns:BoWSPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="writeArray">
<soap:operation soapAction="ADRESSE_WEBSERVICE#writeArray"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="ADRESSE_WEBSERVICE"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="ADRESSE_WEBSERVICE"/>
</output>
</operation>
</binding>
<service name="BoWSService">
<port name="BoWSPort" binding="tns:BoWSBinding">
<soap:address location="ADRESSE_WEBSERVICE"/>
</port>
</service>
<message name="writeArrayIn">
<part name="array" type="soap-enc:Array"/>
</message>
<message name="writeArrayOut">
<part name="return" type="xsd:int"/>
</message>
</definitions> |
Cette fonction fonctionne très bien lorsque je la teste avec soapUI, en lui envoyant le message suivant :
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
|
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="ADRESSE_WEBSERVICE">
<soapenv:Header/>
<soapenv:Body>
<wsdl:writeArray soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENC:Array SOAP-ENC:arrayType="xsd:string[][3]">
<SOAP-ENC:Array id="array-1" SOAP-ENC:arrayType="xsd:string[4]">
<item>26</item>
<item>223</item>
<item>test</item>
<item>test3</item>
</SOAP-ENC:Array>
<SOAP-ENC:Array id="array-2" SOAP-ENC:arrayType="xsd:string[4]">
<item>26</item>
<item>750</item>
<item>test</item>
<item>test4</item>
</SOAP-ENC:Array>
<SOAP-ENC:Array id="array-3" SOAP-ENC:arrayType="xsd:string[4]">
<item>70</item>
<item>360</item>
<item>tes321</item>
<item>test23</item>
</SOAP-ENC:Array>
</SOAP-ENC:Array>
</wsdl:writeArray>
</soapenv:Body>
</soapenv:Envelope> |
Je dois insérer dans cette fonction un tableau multidimensionnel de string depuis un programme en C++.
J'ai géneré les fonctions et headers gSoap à partir de wsdl2h.
Le paramètre array de cette fonction est défini de la manière suivante dans le fichier soapStub.h :
Code:
1 2 3 4 5 6
| struct _Struct_3
{
public:
char **__ptr;
int __size;
}; |
Mon problème est que je ne sait pas du tout utiliser ce type de structure.
Le tableau que je dois insérer est à l'origine un vecteur de vecteurs de strings :
Code:
vector< vector<string> > testArray
Que je peux facilement transformer en tableau de tableaux de strings.
Néanmoins, je suis ensuite bloqué.
Merci d'avance de votre aide.
Cordialement,
Niusha.