Bonjour !
Je développe une application devant consommer un WebService en tant que client sur le site https://www.dmmo.travail.gouv.fr/.
J'ai donc, à partir du fichier WSDL, généré les "artéfacts clients" sous NetBeans 6.9.
J'essaie de me connecter :
Là j'ai un message d'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 byte[] dmmoXml = prepareXmlSource(referenceDepot); DmmoWebServices service = new DmmoWebServices(); DmmoWebServicesPortType port = service.getDmmoWebServicesSOAP11Port0(); int retour = port.declarerDmmo(referenceDepot, dmmoXml);
Or voici la classe du WebService générée :Cannot find 'https://www.dmmo.travail.gouv.fr/axis2/services/DmmoWebServices?wsdl' wsdl. Place the resource correctly in the classpath.
En fait, il plante sur :
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 @WebServiceClient(name = "DmmoWebServices", targetNamespace = "http://DmmoWebServices.webservice.dmmo.dagemo.com", wsdlLocation = "https://www.dmmo.travail.gouv.fr/axis2/services/DmmoWebServices?wsdl") public class DmmoWebServices extends Service { private final static URL DMMOWEBSERVICES_WSDL_LOCATION; private final static WebServiceException DMMOWEBSERVICES_EXCEPTION; private final static QName DMMOWEBSERVICES_QNAME = new QName("http://DmmoWebServices.webservice.dmmo.dagemo.com", "DmmoWebServices"); static { DMMOWEBSERVICES_WSDL_LOCATION = com.dagemo.dmmo.webservice.dmmowebservices.DmmoWebServices.class.getResource("https://www.dmmo.travail.gouv.fr/axis2/services/DmmoWebServices?wsdl"); WebServiceException e = null; if (DMMOWEBSERVICES_WSDL_LOCATION == null) { e = new WebServiceException("Cannot find 'https://www.dmmo.travail.gouv.fr/axis2/services/DmmoWebServices?wsdl' wsdl. Place the resource correctly in the classpath."); } DMMOWEBSERVICES_EXCEPTION = e; } public DmmoWebServices() { super(__getWsdlLocation(), DMMOWEBSERVICES_QNAME); } public DmmoWebServices(URL wsdlLocation) { super(wsdlLocation, DMMOWEBSERVICES_QNAME); } private static URL __getWsdlLocation() { if (DMMOWEBSERVICES_EXCEPTION!= null) { throw DMMOWEBSERVICES_EXCEPTION; } return DMMOWEBSERVICES_WSDL_LOCATION; } }
où le getResource sur l'URL renvoie null...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 DMMOWEBSERVICES_WSDL_LOCATION = com.dagemo.dmmo.webservice.dmmowebservices.DmmoWebServices.class.getResource("https://www.dmmo.travail.gouv.fr/axis2/services/DmmoWebServices?wsdl"); WebServiceException e = null; if (DMMOWEBSERVICES_WSDL_LOCATION == null) { e = new WebServiceException("Cannot find 'https://www.dmmo.travail.gouv.fr/axis2/services/DmmoWebServices?wsdl' wsdl. Place the resource correctly in the classpath."); } DMMOWEBSERVICES_EXCEPTION = e;
J'essaie donc d'utiliser avec le 2è contructeur en passant moi même l'URL du fichier WSDL :
Là tout marche jusqu'à la fonction declarerDmmo qui renvoie le message suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 byte[] dmmoXml = prepareXmlSource(referenceDepot); URL wsdlLocation = new URL("https://www.dmmo.travail.gouv.fr/axis2/services/DmmoWebServices?wsdl"); DmmoWebServices service = new DmmoWebServices(wsdlLocation); DmmoWebServicesPortType port = service.getDmmoWebServicesSOAP11Port0(); int retour = port.declarerDmmo(referenceDepot, dmmoXml);
Donc l'exception levée vient-elle du serveur de l'administration ou est-ce qu'il faut régler le 1er problème du classpath ?The server sent HTTP status code 302:Found
![]()
Partager