Bonjour,

Mon sujet existe déjà dans la section XML/XSL et SOAP mais je n'avais pas vu cette section auparavant donc je me réexplique :

Je possède créé un Web service en tant que projet Axis2 sous NetBeans, je le compile et le déploie sans aucune problème.

Voilà ce que ma structure donne une fois déployé sous Axis2 :



Mon problème réside dans le teste de celui-ci à partir de l'url :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
http://localhost:8080/axis2/services/NewAxisFromJava/tauxInscriptionService?service=1
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">
Exception occurred while trying to invoke service method tauxInscriptionService
</soapenv:Text>
</soapenv:Reason>
Et ça pour mes quatre méthodes, je me doute donc qu'il doit y avoir un problème de conception (encore) dans mon code . . .

J'ai d'abord essayé de générer un client via Netbeans et grâce au drag & drop des méthodes (où le code est généré automatiquement) du Web service mais les erreurs sont les mêmes.

Ma classe java en question :

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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
Code :
 
package packageWS;
 
import java.sql.*;
 
public class NewAxisFromJava
{
Connection con;
static String Driver = "com.mysql.jdbc.Driver";
static String url = "jdbcmdss[{:mysql:}]//192.168.1.45:3306/base_projet";
static String login = "damien";
static String password = "damien";
 
//-------------------------------------------------------
// Initialisation du driver OBCD.
//-------------------------------------------------------
 
private void Database()
{
try
{
// Driver JDBC
Class.forName(Driver);
}
catch(Exception e)
{
System.out.println("Erreur lors du chargement du driver:"+ e.getMessage());
}
}
 
//-------------------------------------------------------
// Connection à la base de données.
//-------------------------------------------------------
 
private void Open()
{
try
{
con = DriverManager.getConnection(url,login,password);
}
catch(Exception e)
{
System.out.println("echec d'ouverture:"+e.getMessage());
}
}
 
//-------------------------------------------------------
// Fonction de formatage de Double au centième.
//-------------------------------------------------------
 
static final String ZEROES = "000000000000";
static final String BLANKS = " ";
 
static String format( double val, int n, int w)
{
double incr = 0.5;
for( int j=n; j>0; j--) incr /= 10;
val += incr;
 
String s = Double.toString(val);
int n1 = s.indexOf('.');
int n2 = s.length() - n1 - 1;
 
if (n>n2) s = s+ZEROES.substring(0, n-n2);
else if (n2>n) s = s.substring(0,n1+n+1);
 
if( w>0 & w>s.length() ) s = BLANKS.substring(0,w-s.length()) + s;
else if ( w<0 & (-w)>s.length() )
{
w=-w;
s = s + BLANKS.substring(0,w-s.length()) ;
}
 
return s;
}
 
 
//-------------------------------------------------------
// Calcul du taux d'inscrit par service.
//-------------------------------------------------------
 
private int NombrePotentielIncrit(int service)
{
Database();
Open();
 
int nbrInscritP = 0;
 
try
{
String sql = "SELECT COUNT(ID_usager) AS nb_inscription_potentielle " +
"FROM usager, service WHERE (Age_min_service<=ROUND(DATEDIFF(NOW(),Date_naissance)/365.25,0)" +
"<=Age_max_service) AND ID_service=" + service + ";";
Statement stmt = con.createStatement();
ResultSet r = stmt.executeQuery(sql);
 
while (r.next())
{
nbrInscritP = r.getInt(1);
}
 
con.close();
}
catch (SQLException ex)
{
 
}
 
return nbrInscritP;
}
 
private int NombreInscrit(int service)
{
Database();
Open();
int nbrInscrit = 0;
 
try
{
String sql = "SELECT COUNT(*) FROM inscription WHERE id_service = " + service + ";";
Statement stmt = con.createStatement();
ResultSet r = stmt.executeQuery(sql);
 
while (r.next())
{
nbrInscrit = r.getInt(1);
}
con.close();
}
catch (SQLException ex) {
 
}
return nbrInscrit;
}
 
public String tauxInscriptionService(int service)
{
double taux = 0;
double nbrPI = 0;
double nbrI = 0;
 
nbrPI = new Double(NombrePotentielIncrit(service));
nbrI = new Double(NombreInscrit(service));
 
taux = (nbrI / nbrPI)*100;
 
String s = format(taux,2,1);
 
return s;
}
 
//------------------------------------------------------------------
// Fonction de calcul du Taux de personnes ayant réglé la cantine.
//------------------------------------------------------------------
 
private int NombreInscritRegles()
{
Database();
Open();
 
int nbrInscritR = 0;
 
try
{
String sql = "SELECT COUNT(*) FROM inscription, inscription_usager " +
"WHERE inscription.ID_inscription_usager= inscription_usager.ID_inscription_usager " +
"AND YEAR( Date_paiement_periode ) = YEAR( Date_dernier_paiement ) " +
"AND (MONTH( Date_dernier_paiement ) = MONTH( Date_paiement_periode ) " +
"OR (MONTH( Date_dernier_paiement )-1) = MONTH( Date_paiement_periode )) " +
"AND (01 <= DAY( Date_dernier_paiement ) <= 03) AND ID_service = 5;";
 
Statement stmt = con.createStatement();
 
ResultSet r = stmt.executeQuery(sql);
 
while(r.next())
{
nbrInscritR = r.getInt(1);
}
 
con.close();
}
catch (SQLException ex) {
 
}
return nbrInscritR;
}
 
public String tauxPaiementsCantineRegles()
{
double taux = 0;
double nbrI = 0;
double nbrIR = 0;
 
nbrI = new Double(NombreInscrit(5));
 
nbrIR = new Double(NombreInscritRegles());
 
taux = (nbrIR / nbrI)*100;
 
String s = format(taux,2,1);
 
return s;
}
 
//------------------------------------------------------------------
// Fonction de calcul du Taux de personnes étant en retard pour
// le paiment de la cantine.
//------------------------------------------------------------------
 
public String tauxPaiementsCantineRetard()
{
double taux = 0;
double nbrI = 0;
double nbrIR = 0;
double nbrINR = 0;
 
nbrI = new Double(NombreInscrit(5));
 
nbrIR = new Double(NombreInscritRegles());
 
nbrINR = nbrI - nbrIR;
 
taux = (nbrINR / nbrI)*100;
 
String s = format(taux,2,1);
 
return s;
}
 
 
//---------------------------------------------------------------------------
// Fonction de calcul du Taux de paiement de la cantine non réglé à l'année.
//---------------------------------------------------------------------------
 
private int NombreInscritNonReglesAnnee(int annee)
{
Database();
Open();
 
int nbrInscritNR = 0;
try
{
String sql = "SELECT SUM(nb_non_paiement) FROM non_paiement" +
" WHERE YEAR(Date)=" + annee + ";";
Statement stmt = con.createStatement();
ResultSet r = stmt.executeQuery(sql);
while(r.next())
{
nbrInscritNR = r.getInt(1);
}
 
con.close();
}
catch (SQLException ex) {
 
}
 
return nbrInscritNR;
}
 
private int NombreInscritAnnee(int annee)
{
Database();
Open();
 
int nbrInscritAnnee = 0;
try
{
String sql = "SELECT SUM(nb_personne_inscrite) FROM non_paiement" +
" WHERE YEAR(Date)=" + annee + ";";
Statement stmt = con.createStatement();
ResultSet r = stmt.executeQuery(sql);
while(r.next())
{
nbrInscritAnnee = r.getInt(1);
}
 
con.close();
}
catch (SQLException ex) {
 
}
return nbrInscritAnnee;
}
 
public String tauxPaiementsCantineNonRegles(int annee)
{
double taux = 0;
double nbrI = 0;
double nbrINR = 0;
 
nbrI = new Double(NombreInscritAnnee(annee));
 
nbrINR = new Double(NombreInscritNonReglesAnnee(annee));
 
taux = (nbrINR / nbrI)*100;
 
String s = format(taux,2,1);
 
return s;
}
}
Il me faudrait donc des réponses de connaisseurs sous Axis2