Bonjour,

Avant de commencer je tiens à préciser que mon niveau en Java est très basique surtout dans les Web Services.

Voila mon problème est que je suis incapable d’accéder à mon WSDL à cause de l'authentification. J'ai cru comprendre que c'est du FORM Based. J'ai essayé pas mal de combinaisons différentes :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
  Map<String, Object> req_ctx = ((BindingProvider)dttRService).getRequestContext();
  req_ctx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://.../DTTARMR/DTTARMRService?WSDL");
 
  Map<String, List<String>> headers = new HashMap<String, List<String>>();
  headers.put("Username", Collections.singletonList("xxx"));
  headers.put("Password", Collections.singletonList("xxx123"));
  req_ctx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
Et aussi...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
  CMTSFacilityResponseType response = dttRService.getDTTRPort().getCForF(request);
 
  ((BindingProvider) dttRService).getRequestContext().put(BindingProvider.USERNAME_PROPERTY,"xxx");  
  ((BindingProvider) dttRService).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,"xxx123");
Mais j'obtiens toujours l'erreur :
javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://.../DTTARMR/DTTARMRService?WSDL. It failed with:
Server returned HTTP response code: 401 for URL: http://.../DTTARMR/DTTARMRService?WSDL.
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(Unknown Source)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(Unknown Source)
at javax.xml.ws.Service.<init>(Unknown Source)
at com.rg.dttr.generated.DTTRService.<init>(DTTRService.java:42)
at com.rg.dttR.GetCMTSForFacility.main(GetCMTSForFacility.java:77)
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://.../DTTARMR/DTTARMRService?WSDL
at sun.net.http://www.protocol.http.HttpURLConn...Stream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(Unknown Source)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(Unknown Source)
... 8 more
Si vous avez des questions ou des idées, n'hésitez pas.

Merci d'avance pour votre aide.