Bonjour
J’essaie de récupérer une liste de commandes au travers de mon WebService, j'obtiens un résultat qui ne me convient pasje m’attendais plutot à quelque chose dans ce style :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <return> <listeCommande> <dateCreation>2011-08-17T00:00:00+02:00</dateCreation> <dateModification>2011-08-17T00:00:00+02:00</dateModification> <idClient>000000000001</idClient> <idCommande>00000001</idCommande> </listeCommande> <listeCommande> <dateCreation>2011-08-17T00:00:00+02:00</dateCreation> <dateModification>2011-08-17T00:00:00+02:00</dateModification> <idClient>000000000002</idClient> <idCommande>00000002</idCommande> </listeCommande> </return>
Pour avoir ce résultat j'ai le code suivant :
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 <return> <listeCommande> <Commande> <dateCreation>2011-08-17T00:00:00+02:00</dateCreation> <dateModification> 2011-08-17T00:00:00+02:00</dateModification> <idClient>000000000002</idClient> <idCommande>00000002</idCommande> </Commande> <Commande> <dateCreation>2011-08-17T00:00:00+02:00</dateCreation> <dateModification> 2011-08-17T00:00:00+02:00</dateModification> <idClient>000000000002</idClient> <idCommande>00000002</idCommande> </Commande> </listeCommande> </return>
Publisher :
DataAccesServer :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 public class DataAccesPublisher { private static Endpoint endpoint; public static void main(final String[] args) { endpoint = Endpoint.publish("http://localhost:5555/ws/dataAcces", new DataAccesServerImpl()); } protected final void finalize() { endpoint.stop(); } }
ListeComande :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 @WebService @SOAPBinding(style = Style.RPC) public interface DataAccesServer { @WebMethod ListCommande getCommandeErp30(); }
Commande contient les attributs d'une commande avec les getter et les setter.
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 public class ListCommande { List<Commande> listeCommande; public ListCommande() { listeCommande = new ArrayList<Commande>(); } /** * @return the listeCommande */ public final List<Commande> getListeCommande() { return listeCommande; } /** * @param listeCommande the listeCommande to set */ public final void setListeCommande(List<Commande> listeCommande) { this.listeCommande = listeCommande; } public void add(Commande commande){ listeCommande.add(commande); } }
Comment faire pour obtenir le résultat escompté ? Je débute avec les web services je suis donc ouvert à toute remarque qui me permettrait de faire un travail plus propre.
Merci d'avance
Partager