Bonjour,
J'ai un soucis pour porter sous OpenJDK12 du code qui fonctionne parfaitement sous JDK8.
Pour faire de la validation de n° de Tva j'utilise le service de l'union européenne que l'on trouve ici. Ils fournissent le fichier WSDL pour leur service SOAP.
Avec JDK8, on utilise wsimport.exe pour générer les classes nécessaires. Cela n'est plus fournit avec OpenJDK12, donc j'utilise wsimport.bat du package JAX WS RI Standalone Zipped Bundle qui, en fait, génère pratiquement la même chose.
Le code ci-dessous fonctionne parfaitement avec JDK8
Evidement avec OpenJDK12, il faut ajouter qlq librairies qui sont absentes :
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 package validationtva; import eu.europa.ec.taxud.vies.services.checkvat.CheckVatPortType; import eu.europa.ec.taxud.vies.services.checkvat.CheckVatService; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.ws.Holder; public class ValidationTva { /** * @param args the command line arguments */ public static void main(String[] args) { CheckVatService service = new CheckVatService(); System.out.println(service.getServiceName()); CheckVatPortType port = service.getCheckVatPort(); Holder<String> countryCode = new Holder<>("BE"); Holder<String> vatNumber = new Holder<>("0403170701"); Holder<XMLGregorianCalendar> requestDate = new Holder<>(); Holder<Boolean> valid = new Holder<>(); Holder<String> name = new Holder<>(); Holder<String> address = new Holder<>(); port.checkVat(countryCode, vatNumber, requestDate, valid, name, address); System.out.println("countryCode : >" + countryCode.value + "<"); System.out.println(" vatNumber : >" + vatNumber.value + "<"); System.out.println("requestDate : >" + requestDate.value + "<"); System.out.println(" valid : >" + valid.value + "<"); System.out.println(" name : >" + name.value + "<"); System.out.println(" address : >" + address.value + "<"); } }
jaxb-api-2.3.0.jar
jaxws-api-2.3.1
javax.jws-api-1.1
Mais cela retourne des erreurs :
Je cherche depuis des heures...
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 run: Exception in thread "main" javax.xml.ws.WebServiceException: Provider com.sun.xml.internal.ws.spi.ProviderImpl not found at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:61) at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:58) at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:103) at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:112) at javax.xml.ws.spi.Provider.provider(Provider.java:96) at javax.xml.ws.Service.<init>(Service.java:112) at eu.europa.ec.taxud.vies.services.checkvat.CheckVatService.<init>(CheckVatService.java:42) at validationtva.ValidationTva.main(ValidationTva.java:14) Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at javax.xml.ws.spi.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:90) at javax.xml.ws.spi.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:123) at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:101) ... 5 more
J''aurais besoin d'aide svp.
Merci d'avance.
PS : Tout est là ValidationTva.7z
Partager