Bonjour à tous,
Je débute avec les webservices, et je suis bloqué depuis un moment sur un obstacle qui me paraît insurmontable.
J'utilie Axis 1.4 sous eclipse, et avec un serveur jboss.
J'ai débuter avec des tutos trouvés sur le net (celui de jmdoudou pour ne pas le citer) et j'ai fais un webservice qui fait un simple calcul. Jusque là, aucun problème.
J'ai ensuite ajouter une méthode qui a comme type de retour une classe que j'ai créé, et là c'est le clash.
j'ai toujours la même exception à l'exécution de mon webservice :
Voici la classe que je souhaite renvoyer
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 AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: org.xml.sax.SAXException: Deserializing parameter 'getDocReturn': could not find deserializer for type {http://test.ws.com}WsResponse faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Deserializing parameter 'getDocReturn': could not find deserializer for type {http://test.ws.com}WsResponse at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277) at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at org.apache.axis.client.Call.invoke(Call.java:2467) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at org.apache.axis.client.Call.invoke(Call.java:1727) at be.fgov.minfin.drmc.WebService.execute(WebService.java:33) at be.fgov.minfin.drmc.TestEcmWsCorpse.connect(TestEcmWsCorpse.java:53) at be.fgov.minfin.drmc.TestEcmWsCorpse.testCalculator(TestEcmWsCorpse.java:33) at be.fgov.minfin.drmc.TestEcmWsCorpse.main(TestEcmWsCorpse.java:23) {http://xml.apache.org/axis/}hostname:CZC7180S54 org.xml.sax.SAXException: Deserializing parameter 'getDocReturn': could not find deserializer for type {http://test.ws.com}WsResponse at org.apache.axis.AxisFault.makeFault(AxisFault.java:101) at org.apache.axis.client.Call.invoke(Call.java:2470) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at org.apache.axis.client.Call.invoke(Call.java:1727) at be.fgov.minfin.drmc.WebService.execute(WebService.java:33) at be.fgov.minfin.drmc.TestEcmWsCorpse.connect(TestEcmWsCorpse.java:53) at be.fgov.minfin.drmc.TestEcmWsCorpse.testCalculator(TestEcmWsCorpse.java:33) at be.fgov.minfin.drmc.TestEcmWsCorpse.main(TestEcmWsCorpse.java:23) Caused by: org.xml.sax.SAXException: Deserializing parameter 'getDocReturn': could not find deserializer for type {http://test.ws.com}WsResponse at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277) at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384) at org.apache.axis.client.Call.invoke(Call.java:2467) ... 7 more
Mon webservice
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 package com.ws.test; import java.util.HashMap; import javax.xml.rpc.encoding.Serializer; public class WsResponse implements Serializer { public String getMechanismType() { return null; } /** * */ private static final long serialVersionUID = 1L; private String project ; private HashMap<String, Object> map ; public WsResponse() {} public HashMap<String, Object> getMap() { return map; } public void setMap(HashMap<String, Object> map) { this.map = map; } public String getProject() { return project; } public void setProject(String project) { this.project = project; } public static long getSerialVersionUID() { return serialVersionUID; } }
Je ne comprend pas du tout ce que je dois faire pour pouvoir renvoyer mon objet WsResponse, et tous les tutos que je trouve sur le net ne traite que de webservice simple.
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 package com.ws.test; import java.util.HashMap; public class EcmWs { public String getDocument ( String project, String authenticationCode, String sessionTimeCode, String queryName, HashMap<String, String> queryParameters, String sessionHashCode, boolean isDisplayable) { return "projet : " + project + "\nAuthentication code : " + authenticationCode + "\nSession time code : " + sessionTimeCode + "\nQuery : " + queryName + "\nParameters : " + queryParameters + "\nHash Code : " + sessionHashCode + "\n display the document : " + isDisplayable ; } public WsResponse getDoc ( String project, String authenticationCode, String sessionTimeCode, String queryName, HashMap<String, String> queryParameters, String sessionHashCode, boolean isDisplayable) { HashMap<String, Object> map = new HashMap<String, Object>() ; map.put("projet", project) ; map.put("Authentication code", authenticationCode) ; map.put("Session time code", sessionTimeCode) ; map.put("Query", queryName) ; map.put("Parameters", queryParameters) ; map.put("Hash Code", sessionHashCode) ; map.put("display", isDisplayable) ; WsResponse response = new WsResponse() ; response.setMap(map) ; return response ; } }
Quelqu'un peut il m'aider ou me mettre sur le bon chemin ?
Partager