[newbie] Création d'un Web Service JBoss ws4ee
Bonjour,
Voilà, dans le cadre d'un projet, je dois consommer un WS. Au départ, je n'ai que le WSDL fournit.
N'y connaissant pas grand chose en WS, j'ai cherché un peu sur internet. Finalement, j'ai installé le plugin soapUI pour eclipse. J'ai généré le code des classe du client puis j'ai tenté de les utiliser :
Code:
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
| package interfaceSCG;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import ServicesSGC.WSVersionData;
import localhost.SGCWeb.services.ServicesSGC.*;
public class InterfaceSGC {
public static String getVersion() {
ServicesSGCService w_serv = new ServicesSGCServiceLocator();
WSVersionData w_vdata = new WSVersionData();
try {
ServicesSGC w_port = w_serv.getServicesSGC();
try {
w_vdata = w_port.getVersion();
System.out.println("Test de version = "+w_vdata.getNumVersion());
} catch (RemoteException e) {
e.printStackTrace();
}
} catch (ServiceException e) {
e.printStackTrace();
}
return w_vdata.getNumVersion();
}
} |
Résultat, à l'appel de la classe fonction main qui utilise cette fonction, je prends cette erreur :
Citation:
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.axis.client.Service.getAxisClient(Service.java:104)
at org.apache.axis.client.Service.<init>(Service.java:113)
at localhost.SGCWeb.services.ServicesSGC.ServicesSGCServiceLocator.<init>(ServicesSGCServiceLocator.java:12)
at interfaceSCG.InterfaceSGC.getVersion(InterfaceSGC.java:10)
at interfaceSCG.ClasseTest.main(ClasseTest.java:5)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:370)
at org.apache.axis.components.logger.LogFactory.getLog(LogFactory.java:37)
at org.apache.axis.handlers.BasicHandler.<clinit>(BasicHandler.java:43)
... 5 more
Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
... 9 more
Caused by: java.lang.NullPointerException
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
... 10 more
Donc ... je sais plus trop ou chercher ! J'ai essayé d'enlever des librairies Axis mais ça n'a rien changé.
J'ai trouvé une erreur simulaire mais elle venait de JUnit qui regénérait les librairie
http://ws.apache.org/axis/java/devel...l#JUnitAndAxis
Mais je n'utilise pas JUnit !
Autre point un peu trouble pour moi, c'est la manière de tester la bète ! Pour faire ça, avec soapUI, j'ai créé un MockService pensant que ça émulait le serveur de WS. Mais j'ai peur être tord.
Enfin voilà, si quelqu'un pouvait éclairer ma lanterne, je lui en serait éternellement reconnaissant.
PS : un petit détail qui peu aussi avoir son importance, je n'ai pas accès au WS serveur en question !