Web service Netbeans
futur ingenieure
Messages postés
185
Statut
Membre
-
futur ingenieure Messages postés 185 Statut Membre -
futur ingenieure Messages postés 185 Statut Membre -
Salut ,
Je dois developper un WebService java J2EE,je pense qu'il est simple mais malheureusement, j'ai des problèmes pour réaliser mon application.
en effet , j'ai deux grande problémes:
1) quand j'ajoute une deuxième opération à mon web service , je ne peux pas mais le testé et l'erreur suivante m'affiche :
deploy?path=C:\Users\d...\WebApplication2\build\web&name=WebApplication2&force=true failed on GlassFish Server 3
C:\Users\d...\WebApplication2\nbproject\build-impl.xml:687: The module has not been deployed.
BUILD FAILED (total time: 3 seconds)
2) quand j'ai crée un client webservice , il ne m'affiche aucune erreur mais.. il ne fonctionne pas (reste run...)
Pouvez vous m'aidez?
Auriez vous un exemple simple pour me presenter un webService ??
merci infiniment d'avance
Je dois developper un WebService java J2EE,je pense qu'il est simple mais malheureusement, j'ai des problèmes pour réaliser mon application.
en effet , j'ai deux grande problémes:
1) quand j'ajoute une deuxième opération à mon web service , je ne peux pas mais le testé et l'erreur suivante m'affiche :
deploy?path=C:\Users\d...\WebApplication2\build\web&name=WebApplication2&force=true failed on GlassFish Server 3
C:\Users\d...\WebApplication2\nbproject\build-impl.xml:687: The module has not been deployed.
BUILD FAILED (total time: 3 seconds)
2) quand j'ai crée un client webservice , il ne m'affiche aucune erreur mais.. il ne fonctionne pas (reste run...)
Pouvez vous m'aidez?
Auriez vous un exemple simple pour me presenter un webService ??
merci infiniment d'avance
A voir également:
- Web service Netbeans
- Web office - Guide
- Service spouleur - Guide
- Création site web - Guide
- Numéro service client orange - Guide
- K9 web protection - Télécharger - Contrôle parental
2 réponses
salut
mon deuxième problème est bien résolu , il s'agit d'une bêtise de génération de WSDL ...
et concernant mon premier , j'ai constaté que le problème provient du corps de l'opération ajoutée , son code est le suivant :
@WebMethod(operationName = "SearchOperation")
public JTable SearchOperation(@WebParam(name = "KeyWord")
String KeyWord) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException{ String[] columnNames = {"Videos","Information"};
JTable table = null;
//---------Cconnexion à la base de données:----------------------
String username = "root";
String password = "0000";
Statement stmt;
ResultSet rs;
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://localhost:3306/mabase";
Connection conn = (Connection) DriverManager.getConnection(url, username, password);
System.out.println("OK connexion réussie...");
stmt = (Statement) conn.createStatement();
rs = stmt.executeQuery("select * from videos where nomVideo='"+KeyWord+"'");
String name=rs.getString("nomVideo");
// ResultSetMetaData md = (ResultSetMetaData) rs.getMetaData();
rs.last();
int NbreResultats=rs.getRow();
System.out.println("Le nombre des résultats vaut "+NbreResultats);// to del
Object[][] data = new Object[NbreResultats][columnNames.length];
rs.beforeFirst();
String NEWLINE = System.getProperty("line.separator");
while (rs.next()) {
String inf="";
inf=inf+" Nom de la vidèo :"+rs.getString("nomVideo")+NEWLINE+
" Catégorie :"+rs.getString("categorie")+NEWLINE+
" Durée :"+rs.getString("duree")+NEWLINE;
String Ligne1=" Nom de la vidèo :"+rs.getString("nomVideo");
String Ligne2=" Catégorie :"+rs.getString("categorie");
String Ligne3=" Durée :"+rs.getString("duree");
String im=rs.getString("lien");
System.out.println(im);// to del
JLabel label =new JLabel("<html>"+Ligne1+"<br>"+Ligne2+"<br>"+Ligne3+"</html>");
System.out.println(inf);
data[0][0]=null;
data[0][1]=label.getText();
System.out.println(data[0][1].toString());
rs.close();
stmt.close();
table = new JTable(data, columnNames);//enlever final
table.setPreferredScrollableViewportSize(new Dimension(958, 581));
table.setFillsViewportHeight(true);
//table.setDefaultRenderer(null, this);
ImageIcon iconv = new ImageIcon(im);
// table.getColumnModel().getColumn(0).setCellRenderer((TableCellRenderer) new ImageRenderer());//importanteeeeee
table.setRowHeight(300);
JScrollPane scrollPane = new JScrollPane(table);//Create the scroll pane and add the table to it.
table.add(scrollPane);//Add the scroll pane to this panel.
}
return table;
}
pouvez vous m'aider à le rectifier
merci d'avance
mon deuxième problème est bien résolu , il s'agit d'une bêtise de génération de WSDL ...
et concernant mon premier , j'ai constaté que le problème provient du corps de l'opération ajoutée , son code est le suivant :
@WebMethod(operationName = "SearchOperation")
public JTable SearchOperation(@WebParam(name = "KeyWord")
String KeyWord) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException{ String[] columnNames = {"Videos","Information"};
JTable table = null;
//---------Cconnexion à la base de données:----------------------
String username = "root";
String password = "0000";
Statement stmt;
ResultSet rs;
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://localhost:3306/mabase";
Connection conn = (Connection) DriverManager.getConnection(url, username, password);
System.out.println("OK connexion réussie...");
stmt = (Statement) conn.createStatement();
rs = stmt.executeQuery("select * from videos where nomVideo='"+KeyWord+"'");
String name=rs.getString("nomVideo");
// ResultSetMetaData md = (ResultSetMetaData) rs.getMetaData();
rs.last();
int NbreResultats=rs.getRow();
System.out.println("Le nombre des résultats vaut "+NbreResultats);// to del
Object[][] data = new Object[NbreResultats][columnNames.length];
rs.beforeFirst();
String NEWLINE = System.getProperty("line.separator");
while (rs.next()) {
String inf="";
inf=inf+" Nom de la vidèo :"+rs.getString("nomVideo")+NEWLINE+
" Catégorie :"+rs.getString("categorie")+NEWLINE+
" Durée :"+rs.getString("duree")+NEWLINE;
String Ligne1=" Nom de la vidèo :"+rs.getString("nomVideo");
String Ligne2=" Catégorie :"+rs.getString("categorie");
String Ligne3=" Durée :"+rs.getString("duree");
String im=rs.getString("lien");
System.out.println(im);// to del
JLabel label =new JLabel("<html>"+Ligne1+"<br>"+Ligne2+"<br>"+Ligne3+"</html>");
System.out.println(inf);
data[0][0]=null;
data[0][1]=label.getText();
System.out.println(data[0][1].toString());
rs.close();
stmt.close();
table = new JTable(data, columnNames);//enlever final
table.setPreferredScrollableViewportSize(new Dimension(958, 581));
table.setFillsViewportHeight(true);
//table.setDefaultRenderer(null, this);
ImageIcon iconv = new ImageIcon(im);
// table.getColumnModel().getColumn(0).setCellRenderer((TableCellRenderer) new ImageRenderer());//importanteeeeee
table.setRowHeight(300);
JScrollPane scrollPane = new JScrollPane(table);//Create the scroll pane and add the table to it.
table.add(scrollPane);//Add the scroll pane to this panel.
}
return table;
}
pouvez vous m'aider à le rectifier
merci d'avance