Solved

Consume rpc/encoded webservice using axis + client certificate

Posted on 2014-01-02
4
537 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now