Search code examples
javajax-ws

Build on Jenkins fails: error: package com.sun.xml.internal.ws.client does not exist


I've added this line to my JAX-WS client

bindingProvider.getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, this.timeoutRequest);

It builds just fine in IntelliJ, but the build can't complete on Jenkins. I'm getting error: package com.sun.xml.internal.ws.client does not exist

As I understand, I shouldn't use internal classes, so is there a different way of setting request timeout?


Solution

  • Project appears to use org.apache.cxf JAX WS implementation.

    Used org.apache.cxf.transports.http.configuration.HTTPClientPolicy to set timeout.

    Client client = ClientProxy.getClient(port);
    HTTPConduit http = (HTTPConduit) client.getConduit();
    HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
    httpClientPolicy.setConnectionTimeout(this.timeout);
    httpClientPolicy.setReceiveTimeout(this.timeout);
    http.setClient(httpClientPolicy);
    

    There's more info in Apache CXF docs.