Solved

Consume rpc/encoded webservice using axis + client certificate

Posted on 2014-01-02
4
544 Views
Last Modified: 2014-01-07
Hi,

I'm trying to build a webservice client using IntelliJ 13.
The webservice is rpc/encoded so I'm using an old version of Axis (I think it's 1.4).
I need to use a client certificate to access it.

The client I created works fine with the non-https version, but now I need to add the magic to make client certificates work. I found lots of examples on the internet but it's all for Axis 2 and I'm using an older version. Axis 2 doesn't support rpc/encoded.

So, my question is: what do I have to do to load a client certificate before I access the webservice?

regards,

Marco
0
Comment
Question by:mvanrooij
  • 2
  • 2
4 Comments
 
LVL 35

Assisted Solution

by:mccarl
mccarl earned 250 total points
ID: 39752820
Have you tried setting the System Properties "javax.net.ssl.keyStore" to point to the location of your file containing the client certificate and "javax.net.ssl.keyStorePassword" to the password for that keystore file?

If everything is left as default, I believe the Axis (even 1.4) will use the standard Java SSL implementations that will use the above system properties to locate a keystore containing the client certificate. And then when the server request the client certificate (as part of the SSL handshake), the certificate can be found and passed along to the server.

Have you debugged the SSL connection to see exactly what is happening between client and server? (You can do this by setting an additional system property "javax.net.debug" to "all", ie.       -Djavax.net.debug=all       )
0
 
LVL 1

Accepted Solution

by:
mvanrooij earned 0 total points
ID: 39753363
Yes, I tried that but the problem is that System.setProperty makes the setting global and I need to be able to switch certificates at runtime.

After trying to sort this out all night I found an interesting website where a custom SocketFactory is explained. I implemented it and guess what... it works great!

http://staff.washington.edu/fox/notes/ws_client_j.shtml
0
 
LVL 35

Expert Comment

by:mccarl
ID: 39753781
I need to be able to switch certificates at runtime.
Ahh, that wasn't stated in the original question. So yeah, you would need the different solution. Glad that you got it working though! :)
0
 
LVL 1

Author Closing Comment

by:mvanrooij
ID: 39761673
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
V.simple question about Android packages and libraries 1 21
web application structure 18 77
How to convert from xls to xlsx using java 7 40
going to wrong jsp page 2 21
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Online collaboration is quickly becoming embedded in the workplace, and its benefits are tangible. See what the current landscape looks like and what the future holds for collaboration tools and the future of work.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This video teaches viewers about errors in exception handling.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question