Apache CXF via TLS <p>Update on 06/21/2012 A little update. Today I finally caught the exception which is preventing me from connecting to the server. Here is what I get after calling <code>getInputStream()</code>:</p> <pre><code>javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target </code></pre> <p>===========================================================</p> <p><strong>Original message:</strong></p> <p>I'm trying to make my client (the client is not written entirely by me) work with a published web service over TLS (the client works over http). I'm new to this area I've never worked with web services closely before. I've checked with soapUI that the web service is correctly published and accessible. The address is <strong>https://:9080/SOAOICCT/services/SessionService?wsdl</strong>. I can send a request and receive a reply. But my client throws a lot of exceptions. Here are the most important:</p> <pre><code>javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service. at &lt;My class.my method&gt;(SessionServiceDAO.java:548) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ...... Caused by: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service. at org.apache.cxf.jaxws.ServiceImpl.&lt;init&gt;(ServiceImpl.java:150) at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:65) at javax.xml.ws.Service.&lt;init&gt;(Service.java:56) ......... Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: java.lang.IllegalArgumentException: InputSource must have a ByteStream or CharacterStream at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:226) at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:179) at org.apache.cxf.wsdl11.WSDLServiceFactory.&lt;init&gt;(WSDLServiceFactory.java:91) ... 70 more Caused by: java.lang.IllegalArgumentException: InputSource must have a ByteStream or CharacterStream at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:983) at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:217) ... 72 more </code></pre> <p>I've tracked this issue to the method <code>java.net.HttpURLConnection.getResponseCode()</code>. Here it is:</p> <pre><code>public int getResponseCode() throws IOException { /* * We're got the response code already */ if (responseCode != -1) { return responseCode; } /* * Ensure that we have connected to the server. Record * exception as we need to re-throw it if there isn't * a status line. */ Exception exc = null; try { getInputStream(); } catch (Exception e) { exc = e; } </code></pre> <p>I get an exception at <code>getInputStream()</code> and never actually connect to the server. This exception is later swallowed in <code>org.apache.cxf.transport.TransportURIResolver.resolve(String, String)</code> here</p> <pre><code>} catch (Exception e) { //ignore } </code></pre> <p>The issue seems to be something very simple like authentication or a parameter. Are there any obvious reasons why I cannot connect to the web service? I'm a newbie I can make even a very simple mistake.</p> <p>Here is my <code>http:conduit</code>:</p> <pre><code>&lt;http:conduit name="*.http-conduit"&gt; &lt;http:tlsClientParameters secureSocketProtocol="TLS"&gt; &lt;sec:trustManagers&gt; &lt;sec:keyStore type="JKS" password="123123" file="config.soa.client/trustedCA.keystore"/&gt; &lt;/sec:trustManagers&gt; &lt;sec:cipherSuitesFilter&gt; &lt;sec:include&gt;SSL_RSA_WITH_RC4_128_MD5&lt;/sec:include&gt; &lt;sec:include&gt;SSL_RSA_WITH_RC4 _128_SHA&lt;/sec:include&gt; &lt;sec:include&gt;SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA&lt;/sec:include&gt; &lt;sec:include&gt;.*_EXPORT_.*&lt;/sec:include&gt; &lt;sec:include&gt;.*_EXPORT1024_.*&lt;/sec:include&gt; &lt;sec:include&gt;.*_WITH_DES_.*&lt;/sec:include&gt; &lt;sec:include&gt;.*_WITH_NULL_.*&lt;/sec:include&gt; &lt;sec:exclude&gt;.*_DH_anon_.*&lt;/sec:exclude&gt; &lt;/sec:cipherSuitesFilter&gt; &lt;/http:tlsClientParameters&gt; &lt;/http:conduit&gt; </code></pre> <p>A little update. Today I finally caught the exception which is preventing me from connecting to the server. Here is what I get after calling <code>getInputStream()</code>:</p> <pre><code>javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target </code></pre>