Skip to main content

Error failed to connect WS with jax-ws

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2013-03-28

Hi all,

I need to connect to a web service then write a java client.
So I use the wsimport tool to generate the classes to connect to this service.
The problem is that this service requires authentication with login / password, so I test from the browser and retrieve the wsdl locally.

So I had a class (JAX-WS) as what:

    private final static Logger logger = Logger.getLogger(XXXX.class.getName());
    static {
        URL url = null;
        try {
            URL baseUrl;
            baseUrl = pkg.ClientPullService.class.getResource(".");
            url = new URL(baseUrl, "file:/XXXXXXXXXX.wsdl");
        } catch (MalformedURLException e) {
            logger.warning("Failed to create URL for the wsdl Location: 'file:/XXXXXXXXXX.wsdl', retrying as a local file");
    public ClientPullService(URL wsdlLocation, QName serviceName) {
  super(wsdlLocation, serviceName);
    public ClientPullService() {
        super(CLIENTPULLSERVICE_WSDL_LOCATION, new QName("XXXXXXXXXXX", "clientPullService"));

When I try to use this service:
ClientPullService clientPullService = new ClientPullService();
ClientPullInterface port = clientPullService.getXXXXXXXXXXXPort();
BindingProvider prov = (BindingProvider) port;
Map<String, Object> requestContext = prov.getRequestContext();
Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put("Username", Collections.singletonList("xxx"));
headers.put("Password", Collections.singletonList("xxx"));
requestContext.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
D2LogicalModel datex2Data = port.getMethodX();

I have this error: Failed to access the WSDL at: XXXXX?wsdl. It failed with: PKIX path building failed: unable to find valid certification path to requested target.

What's the problem ? I don't understand ....

If I use the tool soapUI, it work with next parameters:
- Autorisation type preremptive with login/password
- check enable/disable WS-A Addressing

Thanks very much