Thursday, October 09, 2008

Apache Axis Basic Access Authentication

The Apache Axis2 Web Services is very useful when in need of more control of your web service/client. As I found out sometime ago when I need to access a password protected web service. The standard mechanism for protecting SOAP web service is to required the username/password pair on the SOAPHeader section of the SOAPEnvelope. However, there are cases where the web service is protected at the Transport Layer - in my particular problem this was HTTPs and it needed Basic Access Authentication. Fortunately, Apache Axis is an extensible framework in that it caters for all kinds of eventualities and provides means and ways to address even the most un-anticipated of chalanges. To solve my predicament I only had to had the code below:
org.apache.axis.client.Call _call = ... _call.setProperty(org.apache.axis.client.Call.USERNAME_PROPERTY, "username"); _call.setProperty(org.apache.axis.client.Call.PASSWORD_PROPERTY, "password");
And there is just that simple. I have many more tips and tricks to share on Apache Axis.

The Return...

It has been ages since I last updated this blog - the last post was 3 years ago. I now intend to keep this updated as much as I can, and do I have material to share.