Bonjour à tous,
je suis actuellement entrain de coder pour la première fois sur soap.
J'ai donc commencer par créer ma classe qui contient une fonction de trie
J'ai ensuite fait généré automatiquement mon webclient(je suis sous éclipse).
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
26 package services; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Iterator; import javax.jws.WebParam; import javax.jws.WebService; @WebService(targetNamespace = "http://services/", portName = "OrdonnancePort", serviceName = "OrdonnanceService") public class Ordonnance { public List<Annonce> trie( @WebParam(name = "arg0") List<Annonce> bob) { Collections.sort(bob); for (Iterator iter = (Iterator) bob.iterator(); iter.hasNext();) { Annonce p = (Annonce) iter.next(); System.out.println("Prix = " + p.getPrice() + " Location = " + p.getLocation() + " Numero d'annonce = " + p.getNumber()); } return bob; } }
Je me retrouve avec une erreurs quand je lance mon client
Voici le fichier Ordonnance_OrdonnancePort_Client.javaException in thread "main" javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: null
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:160)
at $Proxy35.trie(Unknown Source)
at client.Ordonnance_OrdonnancePort_Client.main(Ordonnance_OrdonnancePort_Client.java:60)
Es ce que quelqu’un voit d’où pourrait venir mon erreur, j'ai un serveur Tomcatv7.0
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
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 package client; /** * Please modify this class to meet your needs * This class is not complete */ import java.io.File; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; /** * This class was generated by Apache CXF 3.0.3 * 2015-02-06T15:45:09.409+01:00 * Generated source version: 3.0.3 * */ public final class Ordonnance_OrdonnancePort_Client { private static final QName SERVICE_NAME = new QName("http://services/", "OrdonnanceService"); private Ordonnance_OrdonnancePort_Client() { } public static void main(String args[]) throws java.lang.Exception { URL wsdlURL = OrdonnanceService.WSDL_LOCATION; if (args.length > 0 && args[0] != null && !"".equals(args[0])) { File wsdlFile = new File(args[0]); try { if (wsdlFile.exists()) { wsdlURL = wsdlFile.toURI().toURL(); } else { wsdlURL = new URL(args[0]); } } catch (MalformedURLException e) { e.printStackTrace(); } } OrdonnanceService ss = new OrdonnanceService(wsdlURL, SERVICE_NAME); Ordonnance port = ss.getOrdonnancePort(); { System.out.println("Invoking trie..."); java.util.List<client.Annonce> _trie_arg0 = new java.util.ArrayList<client.Annonce>(); client.Annonce _trie_arg0Val1 = new client.Annonce(); _trie_arg0Val1.setLocation("Location-403187538"); _trie_arg0Val1.setNumber("Number1064992908"); _trie_arg0Val1.setPrice("Price593792019"); _trie_arg0.add(_trie_arg0Val1); java.util.List<client.Annonce> _trie__return = port.trie(_trie_arg0); System.out.println("trie.result=" + _trie__return); } System.exit(0); } }
Partager