SOAP request from java returning Certificate exceptions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • moorcroft
    New Member
    • Mar 2008
    • 57

    SOAP request from java returning Certificate exceptions

    I'm sending the following SOAP request to a webservice (I've had to star out some parts of it for privacy purposes):

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
    <soap-env:Header/><soap-env:Body>
    <GetAppList xmlns="https://***.***.***.***/***/***.asmx?op=***">
    <requestId>1</requestId>
    <laNumber>5</laNumber>
    <hashCode>*******</hashCode>
    </GetAppList>
    </soap-env:Body>
    </soap-env:Envelope>
    The following is a stack trace of the error that I am getting and cannot work out why I am getting it, could somebody please help?

    Code:
    javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Could not find trusted certificate
    
    	at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.a(DashoA6275)
    
    	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
    
    	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
    
    	at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275)
    
    	at com.sun.net.ssl.internal.ssl.SunJSSE_az.a(DashoA6275)
    
    	at com.sun.net.ssl.internal.ssl.SunJSSE_ax.a(DashoA6275)
    
    	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
    
    	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.j(DashoA6275)
    
    	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(DashoA6275)
    
    	at sun.net.www.protocol.https.HttpsClient.afterConnect(DashoA6275)
    
    	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA6275)
    
    	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:528)
    
    	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(DashoA6275)
    
    	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:246)
    
    	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:141)
    
    	at java.security.AccessController.doPrivileged(Native Method)
    
    	at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:114)
    
    	at com.sx3.wiz.iplan.inspect.client.PlanningPortalClient$22.construct(PlanningPortalClient.java:870)
    
    	at com.sx3.wiz.iplan.inspect.client.SwingWorker$2.run(SwingWorker.java:110)
    
    	at java.lang.Thread.run(Thread.java:536)

    I'm pretty new to SOAP although I think it might have something to do with the fact that the xml it is using is encapsulated using <soap-env> instead of <soap12:Envelop e>. Would that cause an error or should it matter?
  • moorcroft
    New Member
    • Mar 2008
    • 57

    #2
    Have an update.

    I've found a forum post where a guy posts the following, would this help? Not sure what class to use:

    Greetings,

    The problem lies in the default trustStore provided with Java ( jdk1.4/jre/lib/security/cacerts).
    Heres the steps I took to get fix this problem, they should work for you.
    First, export the certificate into a .cer file. (With internet explorer, goto tools->internet options->content->certificates , and you can export them). Once you have the .cer file, you need to place it in a store that java can use...
    In my case, the only certificate I wanted trusted was the one I provided in the .cer file, so using keytool (provided with java), I imported the certificate to a new store:

    keytool -import -alias <insert alias here> -file <insert .cer filename> -keystore <storename here>

    If you are using a new store name, it should create a file in the current directory with the <storename> you entered. Now, to make the trustManager look in this store during initialization with your application, you can need to set the javax.net.ssl.t rustStore and javax.net.ssl.t rustStorePasswo rd properties (either during runtime, or at the command prompt)

    At the command prompt, it'd look like this:

    java -Djavax.net.ssl. trustStore=<sto rename> -Djavax.net.ssl. trustStorePassw ord=<password>

    And then of course followed by the class you wish to execute-
    Hope this helps

    -Ryan

    Comment

    Working...