FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV Mobile 2024
→
How to send an array of objects to a Webservice ?
How to send an array of objects to a Webservice ?
Débuté par Ntt68, 01 sep. 2015 09:15 - 2 réponses
Connectez-vous…
Ntt68
#1
Membre enregistré
104 messages
Popularité : +1 (1 vote)
Posté le 01 septembre 2015 - 09:15
My Webservice is expecting an array of strings but I'm unable to pass the array to my Webservcice using WM20.
Here's the declaration of the array:
<s:element name="StopOpname">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Authentication" nillable="true" type="tns:Authentication"/>
<s:element minOccurs="1" maxOccurs="1" name="Opname" nillable="true" type="tns:OpnameMainData"/>
<s:element minOccurs="0" maxOccurs="1" name="Wagons" type="tns:ArrayOfString2"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfString2">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="Wagon" nillable="true" type="s:string"/>
</s:sequence>
</s:complexType>
So element "Wagons" should contain an array of 'wagon'
but I'm unable to assign an array of strings to the webservice:
arr_Wagons is Array of strings
results is a RFWS.StopOpnameResponse
params is a RFWS.StopOpname
params.Wagons = arr_Wagons
results = RFWS.StopOpname(params)
WM throws an exception at line 5 (params.Wagons = arr_Wagons). WM is saying the variable params.Wagons is not a subscripted element. How can I solve this kind of problem ? Please help
Signaler
0
0
KJVA
#2
Posté le 01 septembre 2015 - 09:57
I wrote a webservice in java that sends a List<String> result = new ArrayList<String>() to my andorid app;
in WM I process it as follows:
v
1 is wsKAMapp.getListOfMeldingTypes
v
2 is wsKAMapp.getListOfMeldingTypesResponse
v
2
=
wsKAMapp.getListOfMeldingTypes
(
v
1
)
FOR
...
...
n
ID is
int
=
v
2.return
[i]
s
Type is
string
=
v
2.return
[
i
+
1
]
END
don't know how it's the other way around
Signaler
0
0
Ntt68
#3
Posté le 07 septembre 2015 - 10:47
I've just found the solution, the array of 'Wagon' (instead of 'Wagons')
IF garr_Wagons..Occurrence > 0 THEN
params is a RFWS.StopOpname
results is a RFWS.StopOpnameResponse
FOR i=1 TO garr_Wagons..Occurrence
params.Wagons.Wagon[i] = garr_Wagons[i]
END
results = RFWS.StopOpname(params)
END
Signaler
0
0
→ Revenir à WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte