Thursday, June 19, 2008

WebService Client over https (Note: https not http) using Eclipse

All those users who have been spoiled by the amazing eclipse (which includes me) will be even more amazed that the scenario described by me has already not been taken care of by eclipse. Well as there is already a plugin for creating the whole code base of web service client by just giving in the url of the concerned web service. But then there is a problem if the web service has been exposed on Hypertext Transfer Protocol over Secure Socket Layer. In simple words the url is https not http. Given such a scenario the plugin will not be able to generate the client code.

But as lazy I am, I would still like my client code to be auto generated. So here are the steps via which I was able to do it.

Firefox User(other browser user look for ways to get the certificate)
Download Cert Viewer Plus from https://addons.mozilla.org/en-US/firefox/addon/1964/
Restart firefox

Go to the url where the web service has been exposed https://www.xxxx/xxxx.asmx
Accept the certificate permanently which the browser will ask for acceptance
Go to Tools -> Certficate Manager. Go to Websites tab
Select your concerned site and export and save to some

Then type in the following command
keytool -import -alias -file

Actually you should go to your jdk.../gre/lib/security folder
For me it was c:/j2sdk1.4.2_16/jre/lib/security
and type in
keytool -import -keystore cacerts -alias -file /

After doing this now you can let the eclipse do the magic for you and create your web service client code base even for those secured services

Well I am learning the art of outsourcing. Right, I am limited to outsourcing my work to my IDE. Oh technology ...Oh technology !! makes a man/woman inherently an out-sourcer so why there is so much hullabaloo over it.

No comments: